| java.lang.Object java.awt.CardLayout
CardLayout | public class CardLayout implements LayoutManager2,Serializable(Code) | | A 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 first component added to a
CardLayout object is the visible component when the
container is first displayed.
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
CardLayout.addLayoutComponent method can be used to associate a string identifier with a given card
for fast random access.
version: 1.37 01/23/03 author: Arthur van Hoff See Also: java.awt.Container since: JDK1.0 |
Constructor Summary | |
public | CardLayout() Creates a new card layout with gaps of size zero. | public | CardLayout(int hgap, int vgap) Creates a new card layout with the specified horizontal and
vertical gaps. |
currentCard | int currentCard(Code) | | |
CardLayout | public CardLayout()(Code) | | Creates a new card layout with gaps of size zero.
|
CardLayout | public CardLayout(int hgap, int vgap)(Code) | | Creates a new card layout with the specified horizontal and
vertical gaps. The horizontal gaps are placed at the left and
right edges. The vertical gaps are placed at the top and bottom
edges.
Parameters: hgap - the horizontal gap. Parameters: vgap - the vertical gap. |
addLayoutComponent | public void addLayoutComponent(Component comp, Object constraints)(Code) | | Adds the specified component to this card layout's internal
table of names. The object specified by 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.
Parameters: comp - the component to be added. Parameters: constraints - a tag that identifies a particularcard in the layout. See Also: java.awt.CardLayout.show(java.awt.Containerjava.lang.String) exception: IllegalArgumentException - if the constraint is not a string. |
checkLayout | void checkLayout(Container parent)(Code) | | Make sure that the Container really has a CardLayout installed.
Otherwise havoc can ensue!
|
first | public void first(Container parent)(Code) | | Flips to the first card of the container.
Parameters: parent - the name of the parent containerin which to do the layout. See Also: java.awt.CardLayout.last |
getLayoutAlignmentX | public float getLayoutAlignmentX(Container parent)(Code) | | 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.
|
getLayoutAlignmentY | public float getLayoutAlignmentY(Container parent)(Code) | | 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.
|
invalidateLayout | public void invalidateLayout(Container target)(Code) | | Invalidates the layout, indicating that if the layout manager
has cached information it should be discarded.
|
last | public void last(Container parent)(Code) | | Flips to the last card of the container.
Parameters: parent - the name of the parent containerin which to do the layout. See Also: java.awt.CardLayout.first |
layoutContainer | public void layoutContainer(Container parent)(Code) | | Lays out the specified container using this card layout.
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.
Parameters: parent - the name of the parent containerin which to do the layout. See Also: java.awt.Container.doLayout |
next | public void next(Container parent)(Code) | | Flips to the next card of the specified container. If the
currently visible card is the last one, this method flips to the
first card in the layout.
Parameters: parent - the name of the parent containerin which to do the layout. See Also: java.awt.CardLayout.previous |
previous | public void previous(Container parent)(Code) | | Flips to the previous card of the specified container. If the
currently visible card is the first one, this method flips to the
last card in the layout.
Parameters: parent - the name of the parent containerin which to do the layout. See Also: java.awt.CardLayout.next |
toString | public String toString()(Code) | | Returns a string representation of the state of this card layout.
a string representation of this card layout. |
|
|