current mouse coordinates on desktop
hi...
is there any api or methods by which i can know the current coordinates of mouse pointer? the current coordinates should be in screen pixels....
when i try to use MouseMotionListener.... it gives the coordinates of mouse but only when the pointer is on the component which implements that listener...
i want methods by which i can get coordinates of mouse pointer whn it is placed anywhere on the desktop....
thanks in advance....
[475 byte] By [
vvijay6] at [2007-11-25 20:37:59]

# 1
Hi,
As far as I know the Java foundation classes give you no such method. The Robot class has useful methods for manipulating the cursor (moving and clicking it), but you can't find out where the cursor is outside of a Java window.
Try adding the MouseMotionListener on the top-level container (JFrame or whatever). That should work for when the mouse cursor is in that window.
Good luck with overcoming that problem!
Keith
PS: Let me know if you hear of a way to find the cursor position, that would be very useful. Thanks