of GraphicsPanelExample have the same height, 50 , but they have different
widths. An instance of this class is shown in Fig. 17.7, without colors.
Components versus containers
A container is an object that can contain displayable components . JFrame is an
example of a container, and JButton is an example of a component.
Some components are themselves containers, so one can create components
within other components. This provides a great deal of (needed) flexibility in cre-
Figure 17.8 contains a partial hierarchy of components in the GUI system.
In the case of Button and JButton , Button is in the old package java.awt and
JButton is in the new package javax.swing . There are many other such cases.
We have omitted many classes from the hierarchy, including layout man-
agers (like BorderLayout ) and classes that deal with menus.
Box, Filler, Button, Canvas
Label, List, Scrollbar
Partial hierarchy of components and containers