aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to get focus for JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to get focus for JTextField" Watch "How to get focus for JTextField" New topic
Author

How to get focus for JTextField

Anusha Jv
Greenhorn

Joined: Jul 26, 2001
Posts: 19
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

Joined: Dec 06, 2000
Posts: 148
Have u tried adding FocusListener to the textfield, it should work.


- Vinod<br />-------<br />SCJP2
 
Consider Paul's rocket mass heater.
 
subject: How to get focus for JTextField