Absolute Mouse Cursor Position
1 posts in topic
Flat View  Flat View

Posted By:   Nattamai_Jeykumar
Posted On:   Thursday, March 21, 2002 10:43 PM


I have been searching for a way to find out the mouse cursor position even if the cursor goes out of the JFrame Application .

It would be helpful if somebody knows a way to accomplish this.



Re: Absolute Mouse Cursor Position

Posted By:   Paul_Connaughton  
Posted On:   Wednesday, March 27, 2002 01:17 AM

The only mouse events that seem to be generated when the mouse is outside the bounds of a component are 'mouse dragging' events.

According the the MouseMotionListener API: 'Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).'

To convert the mouse co-ordinate into a screen co-ordinate you can then use SwingUtilities.convertPointToScreen().

I cannot find any other way do it using standard java classes. Monitoring events on the EventQueue show that only events that are within the bounds of the frame are ever posted (unless they are dragging events).

Perhaps there is another way using sun.* classes...


About | Sitemap | Contact