I have a JtextArea named textArea2 and I want to search for text and then select it.
My code is not working and I don't know what could possibly be wrong with it.
Code:String textSearch = JOptionPane.showInputDialog("Enter a string to search for"); int left = textArea2.indexOf(textSearch); int right = textArea2.lastIndexOf(textSearch); textArea2.select(left,right);




Reply With Quote