How to get all KeyPresses globally?

A component only receives KeyPresses when it is in focus.

Is there a way to set up a component to receive ALL keypresses, no matter which component is actually currently focused?

Imagine a “KeyLogger” sort of application.

The Desktop has methods like Desktop::addFocusChangeListener() and Desktop::addGlobalMouseListener(), but I see nothing similar for KeyPresses. Maybe I’m missing something obvious…

1 Like