Here you can find the source of setNextFocusable(JComponent component, final JComponent nextFocusable)
static public void setNextFocusable(JComponent component, final JComponent nextFocusable)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Costantino Cerbo./*from w w w . ja v a 2 s . co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Costantino Cerbo - initial API and implementation ******************************************************************************/ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.KeyStroke; public class Main { static public void setNextFocusable(JComponent component, final JComponent nextFocusable) { component.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "setNextFocusable"); component.getActionMap().put("setNextFocusable", new AbstractAction() { public void actionPerformed(ActionEvent e) { nextFocusable.requestFocusInWindow(); } }); } }