java.awt
Class CardLayout
java.lang.Object
|
+--java.awt.CardLayout
All Implemented Interfaces:
LayoutManager2, Serializable
This class implements a card-based layout scheme. Each included
component is treated as a card. Only one card can be shown at a
time. This class includes methods for changing which card is
shown.
Authors:- Tom Tromey <tromey@redhat.com>
- Aaron M. Renn (arenn@urbanophile.com)
CardLayout
public CardLayout()
Initializes a new instance of CardLayout
with horizontal
and vertical gaps of 0.
CardLayout
public CardLayout(int hgap, int vgap)
Create a new CardLayout
object with the specified
horizontal and vertical gaps.
Parameters:
addLayoutComponent
public void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
Add a new component to the layout. The constraint must be a
string which is used to name the component. This string can
later be used to refer to the particular component.
Parameters:
Throws:
addLayoutComponent
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
Add a new component to the layout. The name can be used later
to refer to the component.
Parameters:
first
public void first(java.awt.Container parent)
Cause the first component in the container to be displayed.
Parameters:
getHgap
public int getHgap()
Return this layout manager's horizontal gap.
getLayoutAlignmentX
public float getLayoutAlignmentX(java.awt.Container parent)
Return this layout manager's x alignment. This method always
returns Component.CENTER_ALIGNMENT.
Parameters:
getLayoutAlignmentY
public float getLayoutAlignmentY(java.awt.Container parent)
Returns this layout manager's y alignment. This method always
returns Component.CENTER_ALIGNMENT.
Parameters:
getVgap
public int getVgap()
Return this layout manager's vertical gap.
invalidateLayout
public void invalidateLayout(java.awt.Container target)
Invalidate this layout manager's state.
Parameters:
last
public void last(java.awt.Container parent)
Cause the last component in the container to be displayed.
Parameters:
layoutContainer
public void layoutContainer(java.awt.Container parent)
Lays out the container. This is done by resizing the child components
to be the same size as the parent, less insets and gaps.
Parameters:
maximumLayoutSize
public Dimension maximumLayoutSize(java.awt.Container target)
Get the maximum layout size of the container.
Parameters:
minimumLayoutSize
public Dimension minimumLayoutSize(java.awt.Container target)
Get the minimum layout size of the container.
Parameters:
next
public void next(java.awt.Container parent)
Cause the next component in the container to be displayed. If
this current card is the last one in the deck, the first
component is displayed.
Parameters:
preferredLayoutSize
public Dimension preferredLayoutSize(java.awt.Container parent)
Get the preferred layout size of the container.
Parameters:
previous
public void previous(java.awt.Container parent)
Cause the previous component in the container to be displayed.
If this current card is the first one in the deck, the last
component is displayed.
Parameters:
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
Remove the indicated component from this layout manager.
Parameters:
setHgap
public void setHgap(int hgap)
Set this layout manager's horizontal gap.
Parameters:
setVgap
public void setVgap(int vgap)
Set this layout manager's vertical gap.
Parameters:
show
public void show(java.awt.Container parent, java.lang.String name)
Cause the named component to be shown. If the component name is
unknown, this method does nothing.
Parameters:
toString
public String toString()
Returns a string representation of this layout manager.
Returns:
- A string representation of this object.