Java – Get Mouse Position

javamouse

I would like to simulate a natural mouse movement in Java (going from here to there pixel by pixel). To do that I need to know the starting coordinates.

I've found the method event.getX() and event.getY() but I need an event…

How can I know the positions without doing anything (or something not visible)?

Thank you

Best Answer

MouseInfo.getPointerInfo().getLocation() might be helpful. It returns a Point object corresponding to current mouse position.

Related Topic