Illustration of BorderLayout with Embedded GridLayout
Here are several versions of the same applet displayed in
different sized areas. Note how we put a Panel with a GridLayout in the center
of the BorderLayout.
Here the width is 350 and the height is 180
Here the width is 200 and the height is 250
Here is the code for the applet
import java.awt.*;
public class BorderGrid extends java.applet.Applet
{
public void init()
{
setLayout(new BorderLayout());
Panel p = new Panel();
p.add(new Label("This is North"));
add("North",p);
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);
p = new Panel();
p.setLayout(new GridLayout(3,1,5,5));
p.add(new Button("Five"));
p.add(new TextField());
p.add(new Button("Six"));
add("Center", p);
}
}