aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes capture events outside of JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "capture events outside of JFrame" Watch "capture events outside of JFrame" New topic
Author

capture events outside of JFrame

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
i know that you can capture mouse events inside the JFrame, but what if i wanted to keep track of everytime a mouse button was clicked, even outside the JFrame. Is there a way to accomplish this in java? or do i need to look into another programming language?

Justin


You down with OOP? Yeah you know me!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

No - Swing/AWT events are component based - i.e. events have to "happen" to a component for them to be recognized - you'd have to use something else through JNI.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Timothy Wall
Greenhorn

Joined: Sep 14, 2002
Posts: 14
Originally posted by Justin Fox:
i know that you can capture mouse events inside the JFrame, but what if i wanted to keep track of everytime a mouse button was clicked, even outside the JFrame. Is there a way to accomplish this in java? or do i need to look into another programming language?

Justin


JNA (http://jna.dev.java.net) might make things easier; I wrote a utility using it to detect which keys are currently pressed that works on w32 and X11 systems. You still have to dig into native OS APIs, but it's much easier than JNI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: capture events outside of JFrame