Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.CardLayout
CardLayout
object is a layout manager for a
container. It treats each component in the container as a card.
Only one card is visible at a time, and the container acts as
a stack of cards.
The ordering of cards is determined by the container's own internal
ordering of its component objects. CardLayout
defines a set of methods that allow an application to flip
through these cards sequentially, or to show a specified card.
The addLayoutComponent
method can be used to associate a string identifier with a given card
for fast random access.
Constructor Summary | |
CardLayout()
|
|
CardLayout(int hgap,
int vgap)
|
Method Summary | |
void | addLayoutComponent(Component comp,
Object constraints)
|
void | addLayoutComponent(String name,
Component comp)
|
void | first(Container parent)
|
int | getHgap()
|
float | getLayoutAlignmentX(Container parent)
|
float | getLayoutAlignmentY(Container parent)
|
int | getVgap()
|
void | invalidateLayout(Container target)
|
void | last(Container parent)
|
void | layoutContainer(Container parent)
|
Dimension | maximumLayoutSize(Container target)
|
Dimension | minimumLayoutSize(Container parent)
|
void | next(Container parent)
|
Dimension | preferredLayoutSize(Container parent)
|
void | previous(Container parent)
|
void | removeLayoutComponent(Component comp)
|
void | setHgap(int hgap)
|
void | setVgap(int vgap)
|
void | show(Container parent,
String name)
name , using addLayoutComponent .
|
String | toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CardLayout()
public CardLayout(int hgap, int vgap)
hgap
- the horizontal gap.
vgap
- the vertical gap.
Method Detail |
public int getHgap()
public void setHgap(int hgap)
hgap
- the horizontal gap between components.
public int getVgap()
public void setVgap(int vgap)
vgap
- the vertical gap between components.
public void addLayoutComponent(Component comp, Object constraints)
constraints
must be a string. The card layout stores this string as a key-value
pair that can be used for random access to a particular card.
By calling the show
method, an application can
display the component with the specified name.
comp
- the component to be added.
constraints
- a tag that identifies a particular
card in the layout.
public void addLayoutComponent(String name, Component comp)
addLayoutComponent(Component, Object)
.
public void removeLayoutComponent(Component comp)
comp
- the component to be removed.
public Dimension preferredLayoutSize(Container parent)
parent
- the name of the parent container.
public Dimension minimumLayoutSize(Container parent)
parent
- the name of the parent container
in which to do the layout.
public Dimension maximumLayoutSize(Container target)
target
- the component which needs to be laid out
public float getLayoutAlignmentX(Container parent)
public float getLayoutAlignmentY(Container parent)
public void invalidateLayout(Container target)
public void layoutContainer(Container parent)
Each component in the parent
container is reshaped
to be the size of the container, minus space for surrounding
insets, horizontal gaps, and vertical gaps.
parent
- the name of the parent container
in which to do the layout.
public void first(Container parent)
parent
- the name of the parent container
in which to do the layout.
public void next(Container parent)
parent
- the name of the parent container
in which to do the layout.
public void previous(Container parent)
parent
- the name of the parent container
in which to do the layout.
public void last(Container parent)
parent
- the name of the parent container
in which to do the layout.
public void show(Container parent, String name)
name
, using addLayoutComponent
.
If no such component exists, then nothing happens.
parent
- the name of the parent container
in which to do the layout.
name
- the component name.
public String toString()
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |