Forums Register Login

capture events outside of JFrame

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1609 times.
Similar Threads
Capture Mouse Events on JTable
How to capture JFrame co-ordinates using mouse co-ordinates
Another Mouse Related Question
Capturing Mouse Events for invisible JWindow or JFrame
mouse related
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:06:12.