I'd like to define a font ( face, style, size, and color) once at the beginning of my program, then apply it to my text components.
I have taken care of the font face, style, and size with
Font font = new Font( "chalkboards", Font.PLAIN, 24);
How do I set the color as well?
If these is a better way to do all these tasks, I'd love to know.
Thanks a million!
A color is not a font attribute (e.g. you can draw an 'A' in red or in blue) so you have to setForeground( ... ) the color of every JComponent (or any class extending it) when you want to draw text in a specific color.
Originally Posted by newbie123
Thanks for your clarification. I played around with both setBackground() and setForeground(), and I seem to get how they work. It seems like a kind of strange way to do something so simple, but I'm new to Java and I'll wait and see.