2

Possible Duplicate:
Event listener in Java without app having focus? (Global keypress detection)

I have an application written in Java and I would like to install a truly global keyboard handler. For instance, I want Ctrl+Alt+Whatever to translate into a "New Document" command in my app. This should happen even if my app does not have focus or is minimized to the system tray.

I know that TomBoy Notes on Ubuntu has this behavior, but I believe it is implemented using the Ubuntu key registry. Omni-Focus on the Mac does this, and I assume it is native code watching the windows event loop.

To my knowledge, this is not possible in a pure Java solution. Is that true? Is there a cross platform way to implement a global keyboard handler as described?

Community
  • 1
  • 1
Jen S.
  • 4,106
  • 4
  • 35
  • 44

1 Answers1

2

There is a library to handle native keyboard and mouse control:
http://code.google.com/p/jnativehook/

Alex Barker
  • 4,316
  • 4
  • 28
  • 47