Catching key events in application

I have a JFrame with a JDesktop containing lots of JInternalFrame with various of components such as JTextFields etc.

Now, i want to have a "main" listener that will catch key events no matter which component that has focus. For example pressing CTRL+A should produce something in the application no matter which component that has focus.

How do I implement this in an easy way?

[397 byte] By [aeona] at [2007-10-2 19:57:07]
# 1
Try adding the keylistener to the main JFrame.
BaltimoreJohna at 2007-7-13 22:36:31 > top of Java-index,Security,Event Handling...
# 2

It doesnt seem to work to add a KeyListener to the JFrame...

this.addKeyListener(new KeyAdapter(){

public void keyTyped(KeyEvent e){

System.out.println("KeyTyped()");

}

public void keyPressed(KeyEvent e){

System.out.println("KeyTyped()");

}

});

Adding that to the JFrame gives nothing to System.out when a JTextArea inside an JInternalFrame has focus.

aeona at 2007-7-13 22:36:31 > top of Java-index,Security,Event Handling...
# 3
I think i found a solution at: http://www.smotricz.com/kabutz/Issue007.html
aeona at 2007-7-13 22:36:31 > top of Java-index,Security,Event Handling...