0

How can I change the color of the font or text?
I've tried area.setFontColor, area.setColor, comic.setColor.
area is the JTextArea.
comic is a font.
arial is a font.
I have a

final Color red = new Color();
red = Color.red;

but I don't know how to set the Font or Text to a Color. Do you know how?

4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by Ranjitdani
0

You have create an instance of Font first and use that in your setFont() call.

Take a look at the tutorial on using JTextArea.

The tutorial on your link doesn't tell me anything about the color of the font.

0

Try putting in this way.it works!

Font font = new Font("Verdana", Font.BOLD, 12);
txt.setFont(font);
txt.setForeground(Color.BLUE);

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.