BorderLayout

The BorderLayout manager is the default Layout Manager for Frames. It places one component in the center of the Frame and four components at the top, bottom, left, and right margins.

Below is (incremental) code for a basic BorderLayout:

  public void init ( ){

    outerBox.setLayout ( new BorderLayout ( ) );

    outerBox.add ( "Center", button1 );
    outerBox.add ( "North", button2 );
    outerBox.add ( "East", button3 );
    outerBox.add ( "South", button4 );
    outerBox.add ( "West", button5 );

  } // end init

Run the applet

The five components within a BorderLayout can be complex, nested structures, themselves, using the same or different layout managers. Below is code for a BorderLayout in which the "South" component is a nested structure:

Panel bottomPanel;

  public void init ( ){

    bottomPanel = new Panel ( );

    bottomPanel.add ( button4 );
    bottomPanel.add ( button6 );

    outerBox.add ( "South", bottomPanel );

  } // end init

Run the applet

Question: in what class is the add method found? What in its definition allows us to add a component with no orientation specified ( as we did with the FlowLayout manager, above ) but to specify "North", "South", etc. as we did for the BorderLayout manager, here?