i have used
enter code here
textArea1=new TextArea();
String s=textArea1.getSelectedText();
g.drawRect(s.length(),s.length(),s.length(),s.length());
but it is not getting.please help me.
i have used
enter code here
textArea1=new TextArea();
String s=textArea1.getSelectedText();
g.drawRect(s.length(),s.length(),s.length(),s.length());
but it is not getting.please help me.
You question is confusing. You use a Swing tag, but you also use a TextArea text which is an AWT component, not a Swing component.
I would suggest that you do use Swing and that you use a JTextArea. In this case you can add a "highlight" to the specified. Here is a custom class that allows you to use a Rectangle Painter for this highlight.