Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read out of focus key press

 
Amol H Lekurwale
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am developing a simple application, where in, there is no UI involved. My java code will be running as a background process. I want to make the program such that, if the user presses the key anywhere i.e. on any window running on the system, my program will be triggered and it will record the key pressed. In short, I want to listen to 'pure keyboard' without any focus concept getting involved. Is there any way to do so. System.in and other things require focus on UI window.

Regards.
Amol
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a tough one. It would involve tying into the event processing system of whatever operating system you are running on. That's more difficult to do in a language like Java than a lower level language like C, but it is possible. It would most likely involve using JNI (Java's native interface) and a thorough understanding of the underlying OS. However, there may be pre-written solutions out there yours for a Google search (and possibly some cash).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic