Try this instead: textArea.setCaretPosition(selStart.intValue()); textArea.moveCaretPosition(selEnd.intValue()); I think the setSelectionStart and setSelectionEnd methods will only work if there is already some text selected.
This is wierd because I know that we got it to work on our program a while back. and here is the code that we used.
As you notice we didn't use anything to "select" the text, and I couldn't find it in any of our code, but I know it had worked. Try it and see if it highlights and select all the text in the JTextBox. If not I'll look again for any code that might suggest that. Mark p.s. What are you converting? What was the old system written in? Ours was Foxpro 2.6
Thanks for the suggestion and code. I'll give it a whirl on Monday morning.
p.s. What are you converting? What was the old system written in? Ours was Foxpro 2.6
I'm actually not doing a conversion, although from the code snippit I posted it must seem that way. I'm just trying to add text highlighting to a prviously written Java module that does data retrieval. [ May 17, 2002: Message edited by: Matt Senecal ]
There's nothing more dangerous than a resourceful idiot. ---Dilbert