wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Listening to mouse motions outside the Window? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Listening to mouse motions outside the Window?" Watch "Listening to mouse motions outside the Window?" New topic
Author

Listening to mouse motions outside the Window?

Tilo Hemp
Ranch Hand

Joined: Nov 21, 2005
Posts: 91
Hi Ranchers,

I want to know about mouse movements that appear outside the java application window. I know that it is possible with mouseDragged when the mouse is pressed inside the window, but it should work without pressing the mouse at all.

One solution would be to listen to the system's event queue (i'm using windows xp), but I don't know how to access it from a java application (I only found a way to listen to the AWT event queue, and there also the mouse events outside the window do not appear).

So, how do I read the system event queue?

Thanks a lot in advance!
Tilo Hemp
Ranch Hand

Joined: Nov 21, 2005
Posts: 91
OK, here is a first solution for those having the same problem and reading the post: In java 1.5, there is the class MouseInfo that also reports the mouse position if it is outside the current application window. The only problem is that it is necessary to poll this in a loop (i.e. it is not event-based and thus costs more resuorces).

If anybody knows about a smarter solution...?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listening to mouse motions outside the Window?
 
Similar Threads
detect mouse event
Listen to mouse events outside a java window
Is there a way to listen to mouse events without a window (or outside a window)?
Mouse pointer outside of application window issue
How to stop application outside?