Home Segments Top Top Previous Next

723: Mainline

In Segment 669, you learned that containers contain components and that containers are components.

In particular, a JFrame instance is a container that contains a variety of component instances, one of which is the content pane, which itself can contain components. The following diagram shows how various components contained by a JFrame instance nest together. Note especially that the content pane—generally a JPanel instance—can contain components such as JComponent instances.

  *--- JRootPane  
  |    *-- JLayeredPane 
  |    |     *-- JMenuBar 
  |    |     |     *-- JPanel (the content pane) 
  v    |     |     | 
*----- v --- | --- | -------------------------------------------* 
|*---------- v --- | ------------------------------------------*| 
||*--------------- | -----------------------------------------*|| 
|||                |                                          ||| 
||*--------------- | -----------------------------------------*|| 
||                 v                                           || 
||*-----------------------------------------------------------*|| 
|||                                                           ||| 
|||   *----*  *----*  *----*                                  ||| 
|||   |    |  |    |  |    |                                  ||| 
|||   |    |  |    |  |    |  <--- components (one or more)   ||| 
|||   |    |  |    |  |    |                                  ||| 
|||   *----*  *----*  *----*                                  ||| 
|||                                                           ||| 
||*-----------------------------------------------------------*|| 
|*-------------------------------------------------------------*| 
*---------------------------------------------------------------*