Border Layout

--------------------------------------
The Border layout manager is a little odd and not exactly what you'd expect in a layout manager, BUT, nonetheless, the designers of Java decided to make it the default layout manager for Frames.

While the Flow layout manager always honors a component's preferred size and the Grid layout manager never does, the Border layout manager does something in between.

The Border layout manager divides its territory into five regions. The names of these regions are North, South, East, West, and Center. Each region may contain a single component (but no region is required to contain a component).


In this applet each of the five regions contain one label with the appropriate name. Study the code to see how components are added. Notice that the alignment within the areas isn't centered.
--------------------------------------
Room For Only One: How many components can be added to a single region using borderLayout? Well there are two ways of looking at it. Strictly speaking only one component may be added to a single region. As an example consider the following applet in which two labels are added to the same region (center). Only one shows up!


--------------------------------------
Using Panels: The way to get more than one component into a single region is to place the components on a panel and then add the panel to the region. Here's an example: