There are a couple of ways to do this, so it really depends on what
you are trying to accomplish. One approach is to attach a
ComponentKeyListener to your window, and any key events that are not
consumed will propagate up from the focused component to the window.
Another alternative is to add an Action to the window's action
dictionary. When a keyReleased() event is processed for an entry in
the dictionary, the corresponding action is performed.
Finally, your application can implement
Application.UnprocessedKeyHandler. The previous two options rely on a
component having the focus, whereas this approach allows your
application to capture key events when no component is focused. We
actually just added this feature today, so you'll need to sync with
SVN if you want to use it right now. :-)
On Jul 21, 2009, at 9:14 PM, Edgar Merino wrote:
Hello, is there a way to define a global ComponentKeyListener? so
far, I'm only able to attach keyboard shortcuts per component, but
they should be available globally.
Edgar Merino