Setting JTextPane Font and Color

Swing’s JTextPane supports styled text, embedded images and components, and other features not available in the AWT TextArea. However, basic operations like setting the font and color for the text are somewhat more complicated with JTextPane than with TextArea and other simpler text components. “Setting JTextPane Font and Color” illustrates the use of character attributes for setting these text properties.