In This Chapter
Setting the font of a text control
Finding out what fonts are available
Playing with colors
Working with system colors
Setting foreground and background colors
In this chapter, I look at ways of dressing up the text that appears in Swing controls. In particular, I show you how to change the font that text is displayed in — including bold, italic, and size — as well as how to change the color of your text.
Most of the examples work with labels, but the methods you call to set the font and color are available to all Swing components because they're defined by the Component class, which all Swing components inherit.
Also, the information about fonts and colors that I present in this chapter applies to graphics created with the methods of the Graphics2D class, which I discuss in Book IX, Chapter 2.