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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to get focus for JTextField" Watch "How to get focus for JTextField" New topic

How to get focus for JTextField

Anusha Jv

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.
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
jQuery in Action, 3rd edition