List of usage examples for javax.swing JComponent setFocusTraversalKeys
public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)
From source file:Main.java
public static void setTabFocusTraversalKeys(final JComponent component) { component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, new HashSet<AWTKeyStroke>(Arrays.asList(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)))); component.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, new HashSet<AWTKeyStroke>( Arrays.asList(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK)))); }
From source file:Main.java
public static void setComponentTraversalKeys(int direction, JComponent component, KeyStroke stroke) { Set<AWTKeyStroke> forwardKeys = component.getFocusTraversalKeys(direction); Set<AWTKeyStroke> newForwardKeys = new HashSet<AWTKeyStroke>(forwardKeys); newForwardKeys.add(stroke);//from w ww. java 2 s.c om component.setFocusTraversalKeys(direction, newForwardKeys); }