Illustration of BorderLayout with Embedded Panels


Here are several versions of the same applet displayed in different sized areas. Note how the embedded panels prevent the BorderLayout from changing the sizes of the Components in the East, West, and South. There is nothing in the North, so no space is allocated for that area.



Here the width is 350 and the height is 100

Here the width is 200 and the height is 250


Here is the code for the applet


import java.awt.*;

public class BorderPanel extends java.applet.Applet
{
    public void init()
    {
        setLayout(new BorderLayout());
        Panel p = new Panel();
        p.add(new Label("A Label"));
        p.add(new Button("Two"));
        add("South",p);
        p = new Panel();
        p.add(new Button("Three"));
        add("East",p);
        p = new Panel();
        p.add(new Button("Four"));
        add("West",p);
        add("Center", new Button("Five"));
    }

}