
Table 2−2: GUI Components of Swing (continued)
Component Name Description
JTextPane A subclass of JEditorPane for displaying and editing
for matted text that is not in HTML or RTF format.
Suitable for adding simple word processing
functionality to an application.
JToggleButton The parent component of both JCheckBox and
JRadioButton.
JToolBar A component that displays a set of user-selectable
tools or actions.
JToolTip A lightweight pop-up window that displays simple
documentation or tips when the mouse pointer lingers
over a component.
JTree A power ful component for the display of tree-
structur ed data. Data values are typically strings, but
the component can be customized to display any kind
of data. Used in conjunction with the
javax.swing.tree package.
Proper ties
Every AWT and Swing component can have its appearance and behavior cus-
tomized by specifying values for its pr operties.InExample 2-1, we set the
text
pr operty of the JButton components by calling the setText() method and the
border pr operty of the JLabel by calling setBorder().
The properties of a component are not a formal part of a Java class, in the way
that the fields and methods of a class are. Instead, the notion of properties is
mer ely a naming convention adopted from the JavaBeans component framework.
When a component defines a pair of public accessor methods whose names begin
with “set” and “get”, this pair of methods defines a ...