The
BorderLayoutmanager is the default Layout Manager forFrames. 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 initRun 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 initRun the applet
Question: in what class is the
addmethod found? What in its definition allows us toadda component with no orientation specified ( as we did with theFlowLayoutmanager, above ) but to specify "North", "South", etc. as we did for theBorderLayoutmanager, here?