List of usage examples for java.awt KeyboardFocusManager setDefaultFocusTraversalKeys
public void setDefaultFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)
From source file:Main.java
/** * Adds the focus forward key.//from w ww . ja va 2 s. c om * * @param button * the button */ public static void addFocusForwardKey(final int button) { final KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); final Set<?> forwardKeys = manager .getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); final Set<KeyStroke> newForwardKeys = new HashSet(forwardKeys); newForwardKeys.add(KeyStroke.getKeyStroke(button, 0)); manager.setDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, newForwardKeys); }