Java > Core SWING advanced programming > 3. TEXT COMPONENTS WITH CUSTOM VIEWS
Chapter 3. TEXT COMPONENTS WITH CUSTOM VIEWS
Topics in this Chapter
The Element Hierarchy
Document Views
View Factories
Tab Handling
Creating Customized Views
Custom Highlighters
Using Customized Views to Build Clever Input Fields
In the first two chapters of this book, you've seen how the document content is stored in the model associated with a text component and how it is possible to store attributes that determine how the text is rendered on the screen. In this chapter, you'll see that the attributes that were discussed in Chapter 2, which exist at both the character and paragraph level, are actually stored in a hierarchy of "elements" that map out the various structures within the document. Once we've described the element structure, we'll move on to look at the last major piece of the Swing text component architecture the collection of View classes that use the information stored in the content model, the element structure, and the attributes to determine how the text should actually appear on the screen. In the second part of this chapter, we'll show you several techniques for creating enhanced text components by implementing custom Views, including a powerful text component that allows you to specify how its content should be rendered using a separately supplied formatting string.