Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The Cursor Position In a JTextField  RSS feed

 
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: 5167
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
Boost this thread!