Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get focus for JTextField

 
Anusha Jv
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a problem in getting focus for a textfield.
I have given requestFocus() and also getCaret().setVisible(true)
I am able to see the cursor but there is no focus for the textfield.
I have included TF.requestFocus() and TF.getCaret().setVisible(true) when I add that TF to a panel in the constructor.
What is the problem with my coding.
Thanks in advance.
Anu
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have u tried adding FocusListener to the textfield, it should work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic