Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listening to mouse motions outside the Window?

 
Tilo Hemp
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic