All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.BorderLayout

java.lang.Object
   |
   +----java.awt.BorderLayout

public class BorderLayout
extends Object
implements LayoutManager2, Serializable
A TNT style border bag layout. It will layout a container using members named "North", "South", "East", "West" and "Center". When you add a component to a container that has a BorderLayout layout manager, be sure to specify a string for where to add the component, for example:
    Panel p = new Panel();
    p.setLayout(new BorderLayout());
    p.add(new Button("Okay"), "South");
 
As a convenience, BorderLayout interprets the absence of a string specification the same as "Center":
    Panel p2 = new Panel();
    p2.setLayout(new BorderLayout());
    p2.add(new TextArea());  // Same as p.add(new TextArea(), "Center");
 
The "North", "South", "East" and "West" components get layed out according to their preferred sizes and the constraints of the container's size. The "Center" component will get any space left over.


Variable Index

 o CENTER
The center layout constraint.
 o EAST
The east layout constraint.
 o NORTH
The north layout constraint.
 o SOUTH
The south layout constraint.
 o WEST
The west layout constraint.

Constructor Index

 o BorderLayout()
Constructs a new BorderLayout with no gaps between components.
 o BorderLayout(int, int)
Constructs a BorderLayout with the specified gaps.

Method Index

 o addLayoutComponent(Component, Object)
Adds the specified component to the layout, using the specified constraint object.
 o addLayoutComponent(String, Component)
Replaced by addLayoutComponent(Component, Object). Deprecated.
 o getHgap()
Returns the horizontal gap between components.
 o getLayoutAlignmentX(Container)
Returns the alignment along the x axis.
 o getLayoutAlignmentY(Container)
Returns the alignment along the y axis.
 o getVgap()
Returns the vertical gap between components.
 o invalidateLayout(Container)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 o layoutContainer(Container)
Lays out the specified container.
 o maximumLayoutSize(Container)
Returns the maximum dimensions for this layout given the components in the specified target container.
 o minimumLayoutSize(Container)
Returns the minimum dimensions needed to layout the components contained in the specified target container.
 o preferredLayoutSize(Container)
Returns the preferred dimensions for this layout given the components in the specified target container.
 o removeLayoutComponent(Component)
Removes the specified component from the layout.
 o setHgap(int)
Sets the horizontal gap between components.
 o setVgap(int)
Sets the vertical gap between components.
 o toString()
Returns the String representation of this BorderLayout's values.

Variables

 o NORTH
Properties Public Constant 
    NORTH=String 
The north layout constraint.

 o SOUTH
Properties Public Constant 
    SOUTH=String 
The south layout constraint.

 o EAST
Properties Public Constant 
    EAST=String 
The east layout constraint.

 o WEST
Properties Public Constant 
    WEST=String 
The west layout constraint.

 o CENTER
Properties Public Constant 
    CENTER=String 
The center layout constraint.

Constructors

 o BorderLayout
    method BorderLayout() public 
Constructs a new BorderLayout with no gaps between components.

 o BorderLayout
    method BorderLayout(hgap=int, -
                        vgap=int) public 
Constructs a BorderLayout with the specified gaps.

Parameters:
hgap - the horizontal gap
vgap - the vertical gap

Methods

 o getHgap
    method getHgap() returns int public     
Returns the horizontal gap between components.

 o setHgap
    method setHgap(hgap=int)  public     
Sets the horizontal gap between components.

Parameters:
hgap - the horizontal gap between components
 o getVgap
    method getVgap() returns int public     
Returns the vertical gap between components.

 o setVgap
    method setVgap(vgap=int)  public     
Sets the vertical gap between components.

Parameters:
vgap - the vertical gap between components
 o addLayoutComponent
    method addLayoutComponent(comp=Component, -
                              constraints=Object)  public     
Adds the specified component to the layout, using the specified constraint object.

Parameters:
comp - the component to be added
constraints - where/how the component is added to the layout.
 o addLayoutComponent
    method addLayoutComponent(name=String, -
                              comp=Component)  public     
Note: addLayoutComponent() is deprecated.

Replaced by addLayoutComponent(Component, Object).

 o removeLayoutComponent
    method removeLayoutComponent(comp=Component)  public     
Removes the specified component from the layout.

Parameters:
comp - the component to be removed
 o minimumLayoutSize
    method minimumLayoutSize(target=Container) returns Dimension public     
Returns the minimum dimensions needed to layout the components contained in the specified target container.

Parameters:
target - the Container on which to do the layout
See Also:
Container, preferredLayoutSize
 o preferredLayoutSize
    method preferredLayoutSize(target=Container) returns Dimension public     
Returns the preferred dimensions for this layout given the components in the specified target container.

Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize
 o maximumLayoutSize
    method maximumLayoutSize(target=Container) returns Dimension public     
Returns the maximum dimensions for this layout given the components in the specified target container.

Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize, preferredLayoutSize
 o getLayoutAlignmentX
    method getLayoutAlignmentX(parent=Container) returns float public     
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

 o getLayoutAlignmentY
    method getLayoutAlignmentY(parent=Container) returns float public     
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

 o invalidateLayout
    method invalidateLayout(target=Container)  public     
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

 o layoutContainer
    method layoutContainer(target=Container)  public     
Lays out the specified container. This method will actually reshape the components in the specified target container in order to satisfy the constraints of the BorderLayout object.

Parameters:
target - the component being laid out
See Also:
Container
 o toString
    method toString() returns String public     
Returns the String representation of this BorderLayout's values.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index