File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 2090
    
    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
Facing with Drag and Drop issues
answer to question no8 of sample questions is wrong
JTextField problems
Identify a component that has been added by iteration
shortcut key for label