listening for Tab-key?

Hello everyone,

i am using the KeyListener interface to listen for input in my java/jogl game.

It has been serving me quite well until recently when I wanted to use the tab button. onKeyPressed(KeyEvent ke) doesnt seem to fire whenever I press tab. This is probably due to the tab key being recognized elsewhere and caught before it reaches my canvas.

How can I listen for the TAB key with javas KeyListener interface?

(Using ubuntu 8.10)

KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
	  kfm.setDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
	  kfm.setDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);

it may be that you only need one…

[quote]by default, AWT intercepts tab presses, so it can move focus between components.
You can however disable this feature with java.awt.KeyboardFocusManager
[/quote]
Naturally, while compiling, this is regarded as an unsafe operation.

But other than that it works fine.

it works like a charm :slight_smile: Thanks alot