
about what you can do with the component. This is so useful, in fact, that the ref-
er ence section of this book groups property accessor methods separately from
other methods.
Container s and Containment
Table 2-1 and Table 2-2 listed the GUI components available in the AWT and
Swing toolkits. In order to create a graphical user interface, however, these indi-
vidual components must be arranged within some kind of container. A container
is a component that can contain other components. All containers inherit from the
java.awt.Container base class, which itself inherits from java.awt.Component.
Main application windows and dialog boxes are commonly used containers. Each
pr ovides a window within which GUI components can be arranged to create a
user interface. A graphical application does not usually arrange all its components
dir ectly within a window or dialog box, however. Instead, an application typically
uses containers nested within other containers. For example, a dialog box that
contains two columns of text input fields above a row of push buttons might use
thr ee separate containers, one for each column of text fields and one for the row
of push buttons. Then the dialog box container contains only these three contain-
ers, instead of the full set of text fields and push buttons.
Some kinds of containers display their children in very specific ways, while others
have restrictions on the number ...