Example usage for javax.swing JButton getFocusTraversalKeys

List of usage examples for javax.swing JButton getFocusTraversalKeys

Introduction

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

Prototype

public Set<AWTKeyStroke> getFocusTraversalKeys(int id) 

Source Link

Document

Returns the Set of focus traversal keys for a given traversal operation for this Container.

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

}