Mouse Coordinates

Is it possible to get the mouse coordinates stored in some variable for example X,Y ? The coordinates of the entire window and not alone the java frame. Can someone please help..?

Answers

  • X=mouseX;
    Y=mouseY;
    

    but this is the java window

    maybe robot class can get the absolute coors?

  • That method does not acquire the coordinates for the whole window. I am unable to find a proper method under the robot class... Thanks in advance.

  • Can i use Point p = MouseInfo.getPointerInfo().getLocation(); to get the coordinates. if yes how?

  • edited March 2014

    can't you add the java frame pos to the mouse pos?

    pseudo-Code :

    X=frame.posX+mouseX;
    Y=frame.posY+mouseY;
    
  • PVector p = MouseInfo.getPointerInfo().getLocation();

  • Also how to define a click event to occur when something triggers..?

Sign In or Register to comment.