Java tutorial
//package com.java2s; import javax.swing.JComponent; import javax.swing.SwingUtilities; public class Main { public static void requestFocus(final JComponent component) { SwingUtilities.invokeLater(new Runnable() { public void run() { component.requestFocus(); } }); } }