KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS : KeyboardFocusManager « java.awt « Java by API






KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS

 


import java.awt.AWTKeyStroke;
import java.awt.KeyboardFocusManager;
import java.util.HashSet;
import java.util.Set;

import javax.swing.JButton;
import javax.swing.KeyStroke;

public class Main {
  public static void main(String[] argv) throws Exception {
    JButton component = new JButton("a");

    Set<AWTKeyStroke> set = new HashSet<AWTKeyStroke>(component
        .getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));

    set.add(KeyStroke.getKeyStroke("F2"));
    component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);

  }
}

   
  








Related examples in the same category

1.KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
2.KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
3.KeyboardFocusManager: addPropertyChangeListener(PropertyChangeListener listener)
4.KeyboardFocusManager: clearGlobalFocusOwner()
5.KeyboardFocusManager: focusNextComponent()
6.KeyboardFocusManager: getFocusOwner()
7.KeyboardFocusManager: getFocusedWindow()