Home Segments Top Top Previous Next

670: Mainline

Component classes are subclasses of the Component class; container classes are subclasses of the Container class. The following shows the locations of the Component and Container classes in the Java class hierarchy, as well as the locations of other key classes, JFrame, JApplet, JComponent, and JPanel, which are the focus of this chapter, Chapter 43, and Chapter 39.

The class hierarchy shows that all containers are components, but not all components are containers. It so happens that all the components used in this book are containers because they have Container as a superclass.

*-----------* 
| Object    | 
*-----------* 
  ^ 
  | 
*-----------* 
| Component | 
*-----------* 
  ^ 
  | 
  | 
*-----------* 
| Container | 
*-----------* 
  ^  ^ 
  |  *---------------------------*--------------------------* 
  |                              |                          | 
*-----------*                *-----------*              *------------* 
| Window    |                | Panel     |              | JComponent | 
*-----------*                *-----------*              *------------* 
  ^                              ^                          ^ 
  |                              |                          | 
*-----------*                *-----------*              *------------* 
| Frame     |                | Applet    |              | JPanel     | 
*-----------*                *-----------*              *------------* 
  |                              ^ 
  |                              | 
*-----------*                *-----------* 
| JFrame    |                | JApplet   | 
*-----------*                *-----------*