The six concrete Swing text component classes have quite a
bit in common. Consequently, they share a common base class,
JTextComponent. Figure 19-2 shows the class
hierarchy for the Swing text components. As you can see, the concrete
text components are in the
javax.swing package with the rest of the Swing
component classes, but
and all its supporting classes can be found in
Figure 19-2. The Swing text components
JTextComponent is an abstract
class that serves as the base class for all text-based Swing components.
It defines a large number of properties and methods that apply to its
subclasses. In this introductory chapter, we’ll pass quickly over many
of these properties, as they require an understanding of the underlying
model and view aspects of the text framework.
JTextComponent defines the
properties and default values shown in Table 19-1.
document is a reference to the
Document model for the component, where the
component’s content data is stored. (We’ll discuss the details of the
Document interface in Chapter 22.) The
UI property for all text components is a
Table 19-1. JTextComponent properties
From the UI’s