Please look at requestFocus and requestFocusInWindow methods of the JComponent from the Java API docs : Focus Request Methods .

It is generally advised to use the later and avoid the requestFocus method whenever possible.

Amit Ray.