Here you can find the source of setUseStandardFocusTraversalKeys(Component comp, boolean use)
public static void setUseStandardFocusTraversalKeys(Component comp, boolean use)
//package com.java2s; /*//www. ja v a 2s .co m * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class Main { /** * Sets whether the given {@code Component} uses tab and shift-tab as * forward/backward focus traversal keys. */ public static void setUseStandardFocusTraversalKeys(Component comp, boolean use) { modifyFocusTraversalKeys(comp, true, use, KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)); modifyFocusTraversalKeys(comp, false, use, KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK)); } private static void modifyFocusTraversalKeys(Component comp, boolean forward, boolean add, AWTKeyStroke... keyStrokes) { int dir = forward ? KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS : KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS; Set<AWTKeyStroke> keys = new HashSet<AWTKeyStroke>(comp.getFocusTraversalKeys(dir)); for (AWTKeyStroke key : keyStrokes) { if (add) { keys.add(key); } else { keys.remove(key); } } comp.setFocusTraversalKeys(dir, keys); } }