示例#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 mouseReleased(MouseEvent arg0) {
   if (!matchManager
       .getPhysicsBallMovement()
       .checkThatThereAreNoOverlappingBalls(matchManager.getBalls())) {
     matchManager.setWhiteBallReposition();
     matchManager.setRepositionWithMouse(false);
   } else {
     JOptionPane.showInternalConfirmDialog(
         GamePanel.this,
         "You can not reposition WhiteBall over other Ball",
         "",
         JOptionPane.CLOSED_OPTION);
     Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
     repaint();
   }
 }