• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Selecting Text and Positioning Cursor

 
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic