I'm trying to redefine the behavior of the Tab key in a JRadioButton so it behaves like radio buttons in other GUI applications, that is:
- Arrow keys cycle through the radio buttons in the ButtonGroup (I have this working)
- Tab moves focus to the next component after the last radio button in the group (Problem area)
I have an Action that performs the necessary steps to find the right component to focus and everything, but adding an entry to the InputMap doesn't seem to work:
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "jumpNext");
getActionMap().put("jumpNext", new JumpNextAction());
My entry in the input map for Tab seems to be ignored, as the action never gets executed. I imagine that this is probably because the KeyboardFocusManager or something related is consuming the Tab event before it gets to the component's input map.
Any ideas on how I can stop this behavior and have my custom Tab behavior instead?