1 2 3
| 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...
by default, AWT intercepts tab presses, so it can move focus between components.
You can however disable this feature with java.awt.KeyboardFocusManager
Naturally, while compiling, this is regarded as an unsafe operation.
But other than that it works fine.