Example usage for javax.swing JButton setFocusTraversalKeys

List of usage examples for javax.swing JButton setFocusTraversalKeys

Introduction

In this page you can find the example usage for javax.swing JButton setFocusTraversalKeys.

Prototype

public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes) 

Source Link

Document

Sets the focus traversal keys for a given traversal operation for this Component.

Usage

From source file:Main.java

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

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

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

}

From source file:Main.java

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);

}