This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: How to get focus for JTextField
 
jQuery in Action, 3rd edition