Packages This Package Prev Next Index
public  class  java.awt.BorderLayout
    extends  java.lang.Object  (I-§1.12)
    implements java.awt.LayoutManager  (II-§1.43)
{
        // Constructors
    public BorderLayout();	§1.1.1
    public BorderLayout(int  hgap, int  vgap);	§1.1.2
        // Methods
    public void  addLayoutComponent(String  name,	§1.1.3
          Component  comp);
    public void layoutContainer(Container  target);	§1.1.4
    public Dimension minimumLayoutSize(Container  target);	§1.1.5
    public Dimension preferredLayoutSize(Container  target);	§1.1.6
    public void removeLayoutComponent(Component  comp);	§1.1.7
    public String toString();	§1.1.8
}
A border layout lays out a container using members named "North", "South", "East", "West", 
and "Center". The components get laid out according to their preferred sizes and the constraints of the container's size. The "North" and "South" components may be stretched horizontally; the "East" and "West" components may be stretched vertically; the "Center" 
component may stretch both horizontally and vertically to fill any space left over.
Here is an example of five buttons in an applet laid out using the BorderLayout layout manager
:
The code for this applet is the following:
import java.awt.*; import java.applet.Applet; public class buttonDir extends Applet { public void init() { setLayout(new BorderLayout()); add("North", new Button("North")); add("South", new Button("South")); add("East", new Button("East")); add("West", new Button("West")); add("Center", new Button("Center")); } }
public BorderLayout()
public BorderLayout(int  hgap, int  vgap)
hgap
- the horizontal gap
vgap
- the vertical gap
public void addLayoutComponent(String  name, Component  comp)
name
- a tag understood by the layout manager
comp
- the component to be added
public void layoutContainer(Container  target)
target
- the container in which to do the layout
public Dimension minimumLayoutSize(Container  target)
target
- the container in which to do the layout
public Dimension preferredLayoutSize(Container  target)
target
- the container in which to do the layout
public void removeLayoutComponent(Component  comp)
comp
- the component to be removed
public String toString()
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)