File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes using colors in TextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "using colors in TextArea" Watch "using colors in TextArea" New topic

using colors in TextArea

moshe zochmir

Joined: Aug 26, 2001
Posts: 1
hi there,
Do you know how to change the colors of the font in a textArea
so some lines could be blue other red etc ?
i can use AWT,Swing or whatever else is necessary,
any code examples, links suggestions would be welcomed,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

JTextPane does not support that. You have to use JEditorPane.

Happy Coding,
Gregg Bolinger

GenRocket - Experts at Building Test Data
Sajee Joseph
Ranch Hand

Joined: Jan 17, 2001
Posts: 200
U can do it using JTextPane
I agree. Here's the link:
subject: using colors in TextArea
It's not a secret anymore!