Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes JTextArea - more than one color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextArea - more than one color" Watch "JTextArea - more than one color" New topic

JTextArea - more than one color

Shiva Kumar
Ranch Hand

Joined: Feb 09, 2001
Posts: 30
Hi all,
I want to display each line in a JTextArea in different color, whether is it possible or not, pls help me out
Sudha Lakshman

Joined: Nov 26, 2001
Posts: 17
hi shiva kumar,
have the same question. but the color set on to the text area once will be applicable for the entire text in the text area.
i wanted to implement the text area as it appears in the Yahoo chat! where each user's messages typed are in different colour. (i.e., one colour for each user)
thank you
Shiva Kumar
Ranch Hand

Joined: Feb 09, 2001
Posts: 30
Hi Sudha,
Hey ! For that kind of application i am posted this question. If u got any answer pls let me know.

Joined: Dec 03, 2001
Posts: 1
I posted a similar question that was repelied to by Jane Griscti. I also did quite a bit of research on this topic. For awt you will have to use the Canvas component and if you are using swing you can use the JTextPane. TextArea,JTextArea doesn't support mulitcolor lines. I found this old post at, I hope this helps......GOOD LUCK !!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: JTextArea - more than one color
It's not a secret anymore!