Hello I am using Swings and developing an editor. I am getting a problem that I want to change the color of my Selected Text, either I use Swings JEditorKit or TextArea. The problem is only how to do this.. Can you solve this problem.. Thanks... Syed Usman ------------------ Spacefiller
Spacefiller
Michael Szul
Ranch Hand
Joined: Sep 18, 2001
Posts: 57
posted
0
If you're talking about changing the color of the selector itself (i.e. the selected area), you would probably want to use the UIManager. This is dealt with in Look and Feel. If you just want to change the text color after it's select, you should check out some of the tutorials on styles and JTextPane (I believe's it's JTextPane). The SDK demo comes with an editor showing the use of styles. You might want to check it out.
Ben Wood
Ranch Hand
Joined: Aug 14, 2001
Posts: 342
posted
0
If I'm correct about what you're trying to do , it shoudl simply be: setSelectedTextColor(Color c) so, something like... mytextcomponent.setSelectedTextColor(Color.red); will do it. hope this helps, Ben.