Topics in this Chapter

  • Attributes and Styles

  • Style Contexts

  • Paragraph and Character Attributes

  • Displaying Icons and Attributes in JTextPane

In the last chapter, you saw how the text components store the text that they draw and how to subclass the PlainDocument class used by JTextField to implement various forms of input validation. PlainDocument is a very simple text model that is sufficient for a component that uses a single font and two colors, but the Document interface itself also allows you to associate attributes with arbitrary ranges of content within the model, a facility that can be exploited by using the JTextPane and JEditorPane controls.

In this chapter, you'll see exactly what the attributes that you can store ...

Get Core SWING advanced programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.