/** * tab keystroke to be used for forward traversal. */ private static Set tab = new HashSet( 1 ); static { tab.add(KeyStroke.getKeyStroke( "TAB" )); } /** * shift-tab keystroke to be used for backward traversal. */ private static Set shifttab = new HashSet( 1 ); static { shifttab.add(KeyStroke.getKeyStroke( "shift TAB" )); } /** * Fix component so Tab and Shift-Tab work to * traverse as well as Ctrl-Tab and Ctrl-Shift-Tab. * Only works in JDK 1.4+ * * @param c component to fix, usually a JTextArea */ public static void fixTab ( Component c ) { c.setFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, tab ); c.setFocusTraversalKeys( KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, shifttab ); }