
 |
Chapter 19 java.awt Reference |
 |
BorderLayout
Name
BorderLayout
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.
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.
- Description
-
Constructs a BorderLayout object.
- Parameters
-
- hgap
-
Horizontal space between each component in the container.
- vgap
-
Vertical space between each component in the container.
- Description
-
Constructs a BorderLayout object
with the values specified as the gaps between each component in the container
managed by this instance of BorderLayout.
- Parameters
-
- comp
-
The component being added.
- constraints
-
An object describing the constraints on this component.
- Implements
-
LayoutManager2.addLayoutComponent()
- Description
-
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);
- Parameters
-
- name
-
Name of region to add component to.
- component
-
Actual component being added.
- Implements
-
LayoutManager.addLayoutComponent()
- Description
-
Adds a component to a container
in region name. This has been
replaced in version 1.1 with the more general addLayoutComponent(Component,
Object).
- Returns
-
The horizontal gap for this BorderLayout
instance.
- Parameters
-
- target
-
The container to inspect.
- Returns
-
The value .5 for all containers.
- Description
-
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.
- Parameters
-
- target
-
The container to inspect.
- Returns
-
The value .5 for all containers.
- Description
-
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.
- Returns
-
The vertical gap for this BorderLayout
instance.
- Parameters
-
- target
-
The container to invalidate.
- Description
-
Does nothing.
- Parameters
-
- target
-
The container that needs to be redrawn.
- Implements
-
LayoutManager.layoutContainer()
- Description
-
Draws components contained within target.
- Parameters
-
- target
-
The container to inspect.
- Returns
-
A Dimension whose horizontal
and vertical components are Integer.MAX_VALUE.
- Description
-
For BorderLayout, a maximal
Dimension is always returned.
- Parameters
-
- target
-
The container whose size needs to be calculated.
- Returns
-
Minimum Dimension of the container
target.
- Implements
-
LayoutManager.minimumLayoutSize()
- Description
-
Calculates minimum size of target.
container.
- Parameters
-
- target
-
The container whose size needs to be calculated.
- Returns
-
Preferred Dimension of the
container target.
- Implements
-
LayoutManager.preferredLayoutSize()
- Description
-
Calculates preferred size of target
container.
- Parameters
-
- component
-
Component to stop tracking.
- Implements
-
LayoutManager.removeLayoutComponent()
- Description
-
Removes component from any
internal tracking systems.
- Parameters
-
- hgap
-
The horizontal gap value.
- Description
-
Sets the horizontal gap between components.
- Parameters
-
- vgap
-
The vertical gap value.
- Description
-
Sets the vertical gap between components.
- Returns
-
A string representation of the BorderLayout object.
- Overrides
-
Object.toString()
Component, Container,
Dimension, LayoutManager,
LayoutManager2,
Object, String
|