textfield.requestFocusInWindow() is the method, but if you are talking about when the program first opens, the method must be called after the program's visibility is set to true.
if you are using 1.5, there have been some changes to the focus subsystem that causes the above method not to work properly. in this case try wrapping the method in a SwingUtilities.invokeLater(), or, as a last resort, use a timer with repeats set to false.
Joined: Jan 29, 2006
Thanks..Michael it worked Thanks again for the prompt reply