Replace keyTyped by keyReleased().
to Michael dunn,
I think adding keybindings instead of keylisteners in the above case
won't make any difference as key listeners are notified before key bindings:
The flow is like this(for JComponents):
1) key listeners
2) processComponentKeyEvent(), if the componenet overrides it
3) processKeyBindings..finally
So I think, from a design point of view, the user should actuall override processComponentKeyEvent() instead, as the given key behaviour of the componnet is tightly bound to how the component should be...just a feeling actually
Cheers,
Suraj