Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting Text and Positioning Cursor

 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying jTextField.select(int, int) and jTextField.selectAll() to highlight data in error, and neither will work. I even tried jTextField.setSelectedTextColor(Color.red); to be sure I would have a contrasting color, still doesn't work.
Can anyone help me get this working?
Also, can anywone tell me how to move the cursor to the JTextField in error without selecting any text?
Thank You in Advance for Your Help,
Lou
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As frequently happens, five minutes after I post a question I discover the answer.
jTextField.requestFocus();
jTextField.selectAll(); or jTextField.select(int, int);
To move the cursor only
jTextField.requestFocus();
Happy Coding,
Lou
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic