
 |
Chapter 19 java.awt Reference |
 |
CardLayout
Name
CardLayout
The CardLayout LayoutManager
provides the means to manage multiple components, displaying one at a time.
Components are displayed in the order in which they are added to the layout,
or in an arbitrary order by using an assignable name.
- Description
-
Constructs a CardLayout object.
- Parameters
-
- hgap
-
Horizontal space around left and right of container
- vgap
-
Vertical space around top and bottom of container
- Description
-
Constructs a CardLayout object
with the values specified as the gaps around the container managed by this
instance of CardLayout.
- 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 generalized version of addLayoutComponent(String,
Component). It corresponds to java.awt.Container's
add(Component, Object). In practice, it is used
the same in Java 1.1 as in Java 1.0.2, except with the parameters
swapped:
Panel p = new Panel();
p.setLayoutManager(new CardLayout());
p.add(new Button("OK"), "Don Julio");
- Parameters
-
- name
-
Name of the component to add.
- component
-
The actual component being added.
- Implements
-
LayoutManager.addLayoutComponent()
- Description
-
Places component under the
layout's management, assigning it the given name.
This has been replaced in version 1.1 with the more general addLayoutComponent(Component,
Object).
- Parameters
-
- parent
-
The container whose displayed component is changing.
- Throws
-
- IllegalArgumentException
-
If the LayoutManager of parent is not CardLayout.
- Description
-
Sets the container to display the first component in parent.
- Returns
-
The horizontal gap for this CardLayout
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 CardLayout
instance.
- Parameters
-
- target
-
The container to invalidate.
- Description
-
Does nothing.
- Parameters
-
- parent
-
The container whose displayed component is changing.
- Throws
-
- IllegalArgumentException
-
If the LayoutManager of parent is not CardLayout.
- Description
-
Sets the container to display the final component in parent.
- Parameters
-
- target
-
The container that needs to be redrawn.
- Implements
-
LayoutManager.layoutContainer()
- Description
-
Displays the currently selected component contained within target.
- Parameters
-
- target
-
The container to inspect.
- Returns
-
A Dimension whose horizontal
and vertical components are Integer.MAX_VALUE.
- Description
-
For CardLayout, 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 the target container.
- Parameters
-
- parent
-
The container whose displayed component is changing.
- Throws
-
- IllegalArgumentException
-
If the LayoutManager of parent is not CardLayout.
- Description
-
Sets the container to display the following component in the parent.
- 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 the target
container.
- Parameters
-
- parent
-
The container whose displayed component is changing.
- Throws
-
- IllegalArgumentException
-
If the LayoutManager of parent is not CardLayout.
- Description
-
Sets the container to display the prior component in parent.
- Parameters
-
- component
-
Component to stop tracking.
- Implements
-
LayoutManager.removeLayoutComponent()
- Description
-
Removes component from the
layout manager's internal tables.
- Parameters
-
- hgap
-
The horizontal gap value.
- Description
-
Sets the horizontal gap for the left and right of the container.
- Parameters
-
- vgap
-
The vertical gap value.
- Description
-
Sets the vertical gap for the top and bottom of the container.
- Parameters
-
- parent
-
The container whose displayed component is changing.
- name
-
Name of component to display.
- Throws
-
- IllegalArgumentException
-
If LayoutManager
of parent is not CardLayout.
- Description
-
Sets the container to display the component name
in parent.
- Returns
-
A string representation of the CardLayout object.
- Overrides
-
Object.toString()
Component, Container,
Dimension, LayoutManager,
LayoutManager2, Object,
String
|