예제 #1
0
 @Override
 public void mousePressed(MouseEvent e) {
   if (matchManager.getWhiteBallReposition()) {
     if (matchManager
         .getPhysicsBallMovement()
         .checkThatTheMouseIntersectWithAWhiteBall(e.getX(), e.getY(), matchManager.getBalls())) {
       matchManager.setRepositionWithMouse(true);
       matchManager.setXMouse(e.getX());
       matchManager.setYMouse(e.getY());
     }
   }
 }
예제 #2
0
 @Override
 public void mouseDragged(MouseEvent e) {
   Cursor cursor;
   Toolkit toolkit = getToolkit();
   Point cursorHotSpot = new Point(15, 15);
   if (matchManager
       .getPhysicsBallMovement()
       .checkThatThereAreNoOverlappingBalls(matchManager.getBalls()))
     cursor =
         toolkit.createCustomCursor(ImageProvider.getDivietoPointer(), cursorHotSpot, "wrong");
   else cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
   setCursor(cursor);
   if (matchManager
       .getPhysicsBallMovement()
       .checkThatTheBallDoesNotExceedTheEdgesOfTheTable(
           e.getX(), e.getY(), matchManager.getTable())) {
     matchManager.setXMouse(e.getX());
     matchManager.setYMouse(e.getY());
     this.repaint();
   }
 }