BorderLayout is a LayoutManager that provides the means to lay out components along the edges of a container. It divides the container into five regions, named North, East, South, West, and Center. Normally you won't call the LayoutManager's methods yourself. When you add() a Component to a Container, the Container calls the addLayoutComponent() method of its LayoutManager.
public class java.awt.BorderLayout extends java.lang.Object implements java.awt.LayoutManager2, java.io.Serializable { // Constants public final static String CENTER; public final static String EAST; public final static String NORTH; public final static String SOUTH; public final static String WEST; // Constructors public BorderLayout(); public BorderLayout (int hgap, int vgap); // Instance Methods public void addLayoutComponent (Component comp, Object constraints); public void addLayoutComponent (String name, Component component); public int getHgap(); public abstract float getLayoutAlignmentX(Container target); public abstract float getLayoutAlignmentY(Container target); public int getVgap(); public abstract void invalidateLayout(Container target); public void layoutContainer (Container target); public abstract Dimension maximumLayoutSize(Container target); public Dimension minimumLayoutSize (Container target); public Dimension preferredLayoutSize (Container target); public void removeLayoutComponent (Component component); public void setHgap (int hgap); public void setVgap (int vgap); public String toString(); }
A constant representing center orientation.
A constant representing east orientation.
A constant representing north orientation.
A constant representing south orientation.
A constant representing west orientation.
Constructs a BorderLayout object.
Horizontal space between each component in the container.
Vertical space between each component in the container.
Constructs a BorderLayout object with the values specified as the gaps between each component in the container managed by this instance of BorderLayout.
The component being added.
An object describing the constraints on this component.
LayoutManager2.addLayoutComponent()
Adds the component comp to a container subject to the given constraints. This is a more general version of addLayoutComponent(String, Component) method. It corresponds to java.awt.Container's add(Component, Object) method. In practice, it is used the same in version 1.1 as in Java 1.0.2, except with the parameters swapped:
Panel p = new Panel(new BorderLayout()); p.add(new Button("OK"), BorderLayout.SOUTH);
Name of region to add component to.
Actual component being added.
LayoutManager.addLayoutComponent()
Adds a component to a container in region name. This has been replaced in version 1.1 with the more general addLayoutComponent(Component, Object).
The horizontal gap for this BorderLayout instance.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is left aligned, .5 is centered, and 1 is right aligned.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is top aligned, .5 is centered, and 1 is bottom aligned.
The vertical gap for this BorderLayout instance.
The container to invalidate.
Does nothing.
The container that needs to be redrawn.
LayoutManager.layoutContainer()
Draws components contained within target.
The container to inspect.
A Dimension whose horizontal and vertical components are Integer.MAX_VALUE.
For BorderLayout, a maximal Dimension is always returned.
The container whose size needs to be calculated.
Minimum Dimension of the container target.
LayoutManager.minimumLayoutSize()
Calculates minimum size of target. container.
The container whose size needs to be calculated.
Preferred Dimension of the container target.
LayoutManager.preferredLayoutSize()
Calculates preferred size of target container.
Component to stop tracking.
LayoutManager.removeLayoutComponent()
Removes component from any internal tracking systems.
The horizontal gap value.
Sets the horizontal gap between components.
The vertical gap value.
Sets the vertical gap between components.
A string representation of the BorderLayout object.
Object.toString()
Component, Container, Dimension, LayoutManager, LayoutManager2, Object, String
This HTML Help has been published using the chm2web software. |