@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()); } } }
@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(); } }