Monday, March 9, 2015

Making the mouse cursor go to a specific point within a JPanel


I've used a Robot to make the mouse cursor go to a specific point on the PC's entire display. What I want is to position it right on top of something I've just drawn on the JPanel, using coordinates relative to the upper left corner of the JPanel. I'm sure this is quite straightforward but in an hour of rummaging around I could not find anything. If I knew the screen coordinates of the upper left corner of my JPanel that would be sufficient.


Using getLocation() on the JPanel itself returns (0,0).


Thanks,


DL



No comments:

Post a Comment