This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Multi-color JTextAreas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Multi-color JTextAreas" Watch "Multi-color JTextAreas" New topic

Multi-color JTextAreas

Nick George
Ranch Hand

Joined: Nov 17, 2003
Posts: 38
Is it at all possible to have the text in a JTextArea be of multiple colors? i was hoping for something of the sort
text.setColor(int startpos,int endpos,Color c);
but found no such method
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Not JTextArea, but its more accomplished cousins JEditorPane and JTextPane support this. They're both a bit tricky to use, but this turorial will get you started.
[ edited mildly confusing typo -ds ]
[ January 25, 2004: Message edited by: Dirk Schreckmann ]

[Jess in Action][AskingGoodQuestions]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / JFC / AWT forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Multi-color JTextAreas
It's not a secret anymore!