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 The Cursor Position In a 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 "The Cursor Position In a JTextField" Watch "The Cursor Position In a JTextField" New topic
Author

The Cursor Position In a JTextField

Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 155

Hi There Guys I am Writing a code Where one has to input Something in a JTextField. The cursor is at the beginning on the JTextField and I want it to go to Position 10 by default every time the form Loads. This is what I have triedThis is just Part of the Code)




This Is the Error I get :




Give a beggar a fish; feed him for a day. Teach him how to fish; Feed him for a lifetime.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Set sufficient text first. Your newly constructed text field contains the empty String, so there really isn't a position 10.


luck, db
There are no new questions, but there may be new answers.
Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 155

Thanks Burke I got it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The Cursor Position In a JTextField
 
Similar Threads
JTextPane
Text boxes over an image
Positioning the cursor in an input field
[URGENT]JCombobox and JTextField
How to get or set the caret position in text (JavaScript)