aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Selecting Text and Positioning Cursor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Selecting Text and Positioning Cursor" Watch "Selecting Text and Positioning Cursor" New topic
Author

Selecting Text and Positioning Cursor

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
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

Joined: Nov 11, 2003
Posts: 150
    
    1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Selecting Text and Positioning Cursor