wood burning stoves 2.0*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get focus for JTextField
 
Similar Threads
setting focus
FocusLost help needed
requestFocus() is not working??
How to change the tab order for jumping from one textfield to another
Making control have initial focus