All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.CardLayout

java.lang.Object
   |
   +----java.awt.CardLayout

public class CardLayout
extends Object
implements LayoutManager2, Serializable
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 Index

 o CardLayout()
Creates a new card layout with gaps of size zero.
 o CardLayout(int, int)
Creates a card layout with the specified gaps.

Method Index

 o addLayoutComponent(Component, Object)
Adds the specified component to the layout, using the specified constraint object.
 o addLayoutComponent(String, Component)
Replaced by addLayoutComponent(Component, Object). Deprecated.
 o first(Container)
Flip to the first card.
 o getHgap()
Returns the horizontal gap between components.
 o getLayoutAlignmentX(Container)
Returns the alignment along the x axis.
 o getLayoutAlignmentY(Container)
Returns the alignment along the y axis.
 o getVgap()
Returns the vertical gap between components.
 o invalidateLayout(Container)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 o last(Container)
Flips to the last card of the specified container.
 o layoutContainer(Container)
Performs a layout in the specified panel.
 o maximumLayoutSize(Container)
Returns the maximum dimensions for this layout given the components in the specified target container.
 o minimumLayoutSize(Container)
Calculates the minimum size for the specified panel.
 o next(Container)
Flips to the next card of the specified container.
 o preferredLayoutSize(Container)
Calculates the preferred size for the specified panel.
 o previous(Container)
Flips to the previous card of the specified container.
 o removeLayoutComponent(Component)
Removes the specified component from the layout.
 o setHgap(int)
Sets the horizontal gap between components.
 o setVgap(int)
Sets the vertical gap between components.
 o show(Container, String)
Flips to the specified component name in the specified container.
 o toString()
Returns the String representation of this CardLayout's values.

Constructors

 o CardLayout
    method CardLayout() public 
Creates a new card layout with gaps of size zero.

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

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

Methods

 o getHgap
    method getHgap() returns int public     
Returns the horizontal gap between components.

 o setHgap
    method setHgap(hgap=int)  public     
Sets the horizontal gap between components.

Parameters:
hgap - the horizontal gap between components
 o getVgap
    method getVgap() returns int public     
Returns the vertical gap between components.

 o setVgap
    method setVgap(vgap=int)  public     
Sets the vertical gap between components.

Parameters:
vgap - the vertical gap between components
 o addLayoutComponent
    method addLayoutComponent(comp=Component, -
                              constraints=Object)  public     
Adds the specified component to the layout, using the specified constraint object.

Parameters:
comp - the component to be added
constraints - where/how the component is added to the layout.
 o addLayoutComponent
    method addLayoutComponent(name=String, -
                              comp=Component)  public     
Note: addLayoutComponent() is deprecated.

Replaced by addLayoutComponent(Component, Object).

 o removeLayoutComponent
    method removeLayoutComponent(comp=Component)  public     
Removes the specified component from the layout.

Parameters:
comp - the component to be removed
 o preferredLayoutSize
    method preferredLayoutSize(parent=Container) returns Dimension public     
Calculates the preferred size for the specified panel.

Parameters:
parent - the name of the parent container
Returns:
the dimensions of this panel.
See Also:
minimumLayoutSize
 o minimumLayoutSize
    method minimumLayoutSize(parent=Container) returns Dimension public     
Calculates the minimum size for the specified panel.

Parameters:
parent - the name of the parent container
Returns:
the dimensions of this panel.
See Also:
preferredLayoutSize
 o maximumLayoutSize
    method maximumLayoutSize(target=Container) returns Dimension public     
Returns the maximum dimensions for this layout given the components in the specified target container.

Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize, preferredLayoutSize
 o getLayoutAlignmentX
    method getLayoutAlignmentX(parent=Container) returns float public     
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.

 o getLayoutAlignmentY
    method getLayoutAlignmentY(parent=Container) returns float public     
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.

 o invalidateLayout
    method invalidateLayout(target=Container)  public     
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

 o layoutContainer
    method layoutContainer(parent=Container)  public     
Performs a layout in the specified panel.

Parameters:
parent - the name of the parent container
 o first
    method first(parent=Container)  public     
Flip to the first card.

Parameters:
parent - the name of the parent container
 o next
    method next(parent=Container)  public     
Flips to the next card of the specified container.

Parameters:
parent - the name of the container
 o previous
    method previous(parent=Container)  public     
Flips to the previous card of the specified container.

Parameters:
parent - the name of the parent container
 o last
    method last(parent=Container)  public     
Flips to the last card of the specified container.

Parameters:
parent - the name of the parent container
 o show
    method show(parent=Container, -
                name=String)  public     
Flips to the specified component name in the specified container.

Parameters:
parent - the name of the parent container
name - the component name
 o toString
    method toString() returns String public     
Returns the String representation of this CardLayout's values.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index