    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.

##

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

##

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

##

CardLayout

      public CardLayout()

  Creates a new card layout with gaps of size zero.

CardLayout

      public CardLayout(int hgap,
                        int vgap)

  Creates a card layout with the specified gaps.

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

##

getHgap

      public int getHgap()

  Returns the horizontal gap between components.

setHgap

      public void setHgap(int hgap)

  Sets the horizontal gap between components.

  Parameters:
    hgap - the horizontal gap between components

getVgap

      public int getVgap()

  Returns the vertical gap between components.

setVgap

      public void setVgap(int vgap)

  Sets the vertical gap between components.

  Parameters:
    vgap - the vertical gap between components

addLayoutComponent

      public void addLayoutComponent(Component comp,
                                     Object constraints)

  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.

addLayoutComponent

      public void addLayoutComponent(String name,
                                     Component comp)

  Note: addLayoutComponent() is deprecated.

  Replaced by addLayoutComponent(Component, Object).

removeLayoutComponent

      public void removeLayoutComponent(Component comp)

  Removes the specified component from the layout.

  Parameters:
    comp - the component to be removed

preferredLayoutSize

      public Dimension preferredLayoutSize(Container parent)

  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

minimumLayoutSize

      public Dimension minimumLayoutSize(Container parent)

  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

maximumLayoutSize

      public Dimension maximumLayoutSize(Container target)

  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

getLayoutAlignmentX

      public float getLayoutAlignmentX(Container parent)

  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)

  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)

  Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

layoutContainer

      public void layoutContainer(Container parent)

  Performs a layout in the specified panel.

  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

    All Packages  Class Hierarchy  This Package  Previous  Next  Index