public void mousePressed(MouseEvent evt) { // Checks if the MouseEvent evt lies on the ball // and creates variable b_grabbed. b_grabbed = ball.contains(new Location(evt.getPoint())); }