This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting focus of JTextField

 
Marcus Hoe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone knows how to set focus on specific JTextComponents such as JTextField... after screen loads ?
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic