Is it possible to have different rows in different colors in a textarea? Have you an example for that?
Asked
Active
Viewed 1.5k times
3
-
possible duplicate of [How can I set partial text color in JTextArea?](http://stackoverflow.com/questions/2837848/how-can-i-set-partial-text-color-in-jtextarea) – Andrew Thompson Apr 30 '12 at 23:15
-
Here is an example about [How you can highlight in JTextArea](http://stackoverflow.com/a/10309277/1057230), though If you are more interested in changing the Foreground Colour, here is an example, [How to Change Text Colour with JTextPane](http://stackoverflow.com/a/9652143/1057230) – nIcE cOw May 01 '12 at 05:21
1 Answers
12
Not with a JTextArea
. You can, however, use a JTextPane
which allows for attributes to be applied to text. If you want examples, take a look at the Text Component Tutorial.

Jeffrey
- 44,417
- 8
- 90
- 141