java.awt
Class CardLayout

java.lang.Object
  |
  +--java.awt.CardLayout
All Implemented Interfaces:
LayoutManager

public class CardLayout
extends Object
implements LayoutManager

A layout manager for a container that contains several 'cards'. Only one card is visible at a time, allowing you to flip through the cards.


Constructor Summary
CardLayout()
          Creates a new card layout.
CardLayout(int hgap, int vgap)
          Creates a card layout with the specified gaps.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Adds the specified component with the specified name to the layout.
 void first(Container parent)
          Flip to the first card.
 void last(Container parent)
          Flips to the last card of the specified container.
 void layoutContainer(Container parent)
          Performs a layout in the specified panel.
 Dimension minimumLayoutSize(Container parent)
          Calculates the minimum size for the specified panel.
 void next(Container parent)
          Flips to the next card of the specified container.
 Dimension preferredLayoutSize(Container parent)
          Calculates the preferred size for the specified panel.
 void previous(Container parent)
          Flips to the previous card of the specified container.
 void removeLayoutComponent(Component comp)
          Removes the specified component from the layout.
 void show(Container parent, String name)
          Flips to the specified component name in the specified container.
 String toString()
          Returns the String representation of this CardLayout's values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CardLayout

public CardLayout()
Creates a new card layout.


CardLayout

public CardLayout(int hgap,
                  int vgap)
Creates a card layout with the specified gaps.

Parameters:
hgap - the horizontal gap
vgap - the vertical gap
Method Detail

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Adds the specified component with the specified name to the layout.

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
name - the name of the component
comp - the component to be added

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Removes the specified component from the layout.

Specified by:
removeLayoutComponent in interface LayoutManager
Parameters:
comp - the component to be removed

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Calculates the preferred size for the specified panel.

Specified by:
preferredLayoutSize in interface LayoutManager
Parameters:
parent - the name of the parent container
Returns:
the dimensions of this panel.
See Also:
minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Calculates the minimum size for the specified panel.

Specified by:
minimumLayoutSize in interface LayoutManager
Parameters:
parent - the name of the parent container
Returns:
the dimensions of this panel.
See Also:
preferredLayoutSize(java.awt.Container)

layoutContainer

public void layoutContainer(Container parent)
Performs a layout in the specified panel.

Specified by:
layoutContainer in interface LayoutManager
Parameters:
parent - the name of the parent container

first

public void first(Container parent)
Flip to the first card.

Parameters:
parent - the name of the parent container

next

public void next(Container parent)
Flips to the next card of the specified container.

Parameters:
parent - the name of the container

previous

public void previous(Container parent)
Flips to the previous card of the specified container.

Parameters:
parent - the name of the parent container

last

public void last(Container parent)
Flips to the last card of the specified container.

Parameters:
parent - the name of the parent container

show

public void show(Container parent,
                 String name)
Flips to the specified component name in the specified container.

Parameters:
parent - the name of the parent container
name - the component name

toString

public String toString()
Returns the String representation of this CardLayout's values.

Overrides:
toString in class Object