Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Cursor Position In a JTextField

 
Stanley Mungai
Ranch Hand
Posts: 155
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :



 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set sufficient text first. Your newly constructed text field contains the empty String, so there really isn't a position 10.
 
Stanley Mungai
Ranch Hand
Posts: 155
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Burke I got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic