Here you can find the source of useTabToChangeFocus(Component comp)
static void useTabToChangeFocus(Component comp)
//package com.java2s; import java.awt.Component; import java.awt.KeyboardFocusManager; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.swing.KeyStroke; public class Main { static void useTabToChangeFocus(Component comp) { Set<KeyStroke> strokes = new HashSet<KeyStroke>(Arrays.asList(KeyStroke.getKeyStroke("pressed TAB"))); comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, strokes); strokes = new HashSet<KeyStroke>(Arrays.asList(KeyStroke.getKeyStroke("shift pressed TAB"))); comp.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, strokes); }/*from ww w . j av a 2s .com*/ }