This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Can I set the cursor in a particular JTextField? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can I set the cursor in a particular JTextField?" Watch "Can I set the cursor in a particular JTextField?" New topic
Author

Can I set the cursor in a particular JTextField?

Mike Lipay
Ranch Hand

Joined: Sep 11, 2007
Posts: 171
When my application opens I would like to have the cursor already in the first JTextField on the window. Is there a way to do this? The window layout is:



I've looked in the docs under JTextField and Cursor and couldn't find anything relative.
Thanks.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2153
    
    7


The trick is that the code must be executed "after" the frame is visible.
Mike Lipay
Ranch Hand

Joined: Sep 11, 2007
Posts: 171
Worked perfectly! Many thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I set the cursor in a particular JTextField?
 
Similar Threads
JTextField problems
Identify a component that has been added by iteration
Facing with Drag and Drop issues
answer to question no8 of sample questions is wrong
shortcut key for label