aspose file tools*
The moose likes I/O and Streams and the fly likes Read out of focus key press Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Read out of focus key press" Watch "Read out of focus key press" New topic
Author

Read out of focus key press

Amol H Lekurwale
Greenhorn

Joined: Aug 06, 2009
Posts: 9
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

Joined: Oct 01, 2001
Posts: 2864
    
  11

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
 
subject: Read out of focus key press