The Artima Developer Community
Sponsored Link

Java Answers Forum
changing text color in JTextArea

2 replies on 1 page. Most recent reply: Dec 17, 2004 3:08 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Gibran Shah

Posts: 27
Nickname: gibby
Registered: Jun, 2004

changing text color in JTextArea Posted: Dec 14, 2004 4:34 PM
Reply to this message Reply
Advertisement
Is there a way to set the text color in a JTextArea?


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: changing text color in JTextArea Posted: Dec 15, 2004 5:00 AM
Reply to this message Reply
You mean marking text and setting it's color?

I don't think that's possible directly.

As far as I know, anything that has to do with formating text must be done using html tags.

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: changing text color in JTextArea Posted: Dec 17, 2004 3:08 AM
Reply to this message Reply

jTextArea1.setText("jTextArea1");
jTextArea1.setBounds(new Rectangle(40, 40, 225, 60));
jTextArea1.setForeground(Color.red);


This will change the textcolor to red.

U can customize it also setting the document properties.

Flat View: This topic has 2 replies on 1 page
Topic: Externalizing Strings for *Any* File? Previous Topic   Next Topic Topic: File reading problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use