Java tutorial
//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)))); } }