Java Swing Key Action setTabFocusTraversalKeys(final JComponent component)

Here you can find the source of setTabFocusTraversalKeys(final JComponent component)

Description

set Tab Focus Traversal Keys

License

Apache License

Declaration

public static void setTabFocusTraversalKeys(final JComponent component) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

import java.awt.*;
import java.awt.event.KeyEvent;

import java.util.Arrays;

import java.util.HashSet;

public class Main {
    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 www.j  av a 2  s.c om*/
}

Related

  1. setActionID(final Action a, final String id)
  2. setDefaultOkCancelKeyStrokes(final JRootPane rootPane, final Action okAction, final Action cancelAction)
  3. setEscapeKeyboardAction(final Window window, JComponent pane)
  4. setKeyEvent(JComponent widget, int keyEvent, Runnable action)
  5. setMnemonic(Action action)
  6. setupAction(Action action, ResourceBundle bundle, String actionId)
  7. setUseStandardFocusTraversalKeys(Component comp, boolean use)
  8. simulateEnterKey(Component c)
  9. simulateEnterKeyPressed(final Component component, final int delayInMilliseconds)