GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Setting focus of JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting focus of JTextField" Watch "Setting focus of JTextField" New topic
Author

Setting focus of JTextField

Marcus Hoe
Greenhorn

Joined: May 18, 2001
Posts: 14
Anyone knows how to set focus on specific JTextComponents such as JTextField... after screen loads ?
Renee Zhang
Ranch Hand

Joined: Sep 10, 2001
Posts: 72
Try yourTextField.requestFocus();
It works for me, but you have to put this line after yourFrame.setVisible(true). I don't know if it's a good idea to put any code after yourFrame.setVisible(true).
Good lucks!
 
GeeCON Prague 2014
 
subject: Setting focus of JTextField