Key Bindings

We want to change the behavior of the tab, shift-tab, and the left and right arrow keys.

Swing determines the behavior associated with a keystroke with a combination of the InputMap and ActionMap. As the input map is used in a Swing component, it maps a KeyStroke to a String. The ActionMap then maps that String to an Action. This combination of two maps provides for extensive flexibility. For example, to change a behavior, one need only know the name of the action. Changing the action associated with that name changes the behavior for all keys that map to that name.

InputMap: keystroke action name
ActionMap: action name action

Notes