• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

capture events outside of JFrame

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Timothy Wall
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic