3
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by kramerd
0

You need to implement MouseListener to see if the mouse button has been pressed, and you need to implement MouseMotionListener to keep track of where the mouse cursor is on the screen.

0

I don't have an object so mouseListener isn't what I need. This is my code for finding the location, is there a method that is similar for finding the status of the mouse bottons.
public static int return_x ()

{
   PointerInfo a = MouseInfo.getPointerInfo();
   Point b = a.getLocation();
   int x = (int) b.getX();
   return (x);
 } 
 public static int return_y ()
 {
   PointerInfo a = MouseInfo.getPointerInfo();
   Point b = a.getLocation();
   int y = (int) b.getY();
   return (y);
 } 
}
0

could you tell me how to use mouseListener, I havent been able to get it to work eather, the help library i have is horible.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.