charva.awt
Class CardLayout

java.lang.Object
  extended by charva.awt.CardLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2

public class CardLayout
extends java.lang.Object
implements LayoutManager2

Emulates @{java.awt.CardLayout}.

Author:
lapo@lapo.it

Field Summary
protected  int current
           
protected  int max
           
protected  java.util.HashMap names
           
 
Constructor Summary
CardLayout()
           
 
Method Summary
 void addLayoutComponent(Component component, java.lang.Object constraints)
           
 void doLayout(Container container)
           
 void first(Container container)
          Flips to the first card of the container.
 void invalidateLayout(Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 void last(Container container)
          Flips to the last card of the container.
 Dimension minimumSize(Container container)
          Calculate the geometry for the specified list of Components, and return the size of the rectangle that encloses all the Components.
 void show(Container container, int index)
          Flips to the component with the given insertion index.
 void show(Container container, java.lang.String name)
          Flips to the component that was added to this layout with the specified name, using addLayoutComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

names

protected java.util.HashMap names

current

protected int current

max

protected int max
Constructor Detail

CardLayout

public CardLayout()
Method Detail

addLayoutComponent

public void addLayoutComponent(Component component,
                               java.lang.Object constraints)
Specified by:
addLayoutComponent in interface LayoutManager2

invalidateLayout

public void invalidateLayout(Container target)
Description copied from interface: LayoutManager2
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Specified by:
invalidateLayout in interface LayoutManager2

minimumSize

public Dimension minimumSize(Container container)
Description copied from interface: LayoutManager
Calculate the geometry for the specified list of Components, and return the size of the rectangle that encloses all the Components.

Specified by:
minimumSize in interface LayoutManager

doLayout

public void doLayout(Container container)
Specified by:
doLayout in interface LayoutManager

show

public void show(Container container,
                 int index)
Flips to the component with the given insertion index. If no such component exists, then nothing happens.

Parameters:
container - the parent container in which to do the layout
index - the component index
See Also:
charva.awt.CardLayout#addLayoutComponent(java.awt.Component, java.lang.Object)

show

public void show(Container container,
                 java.lang.String name)
Flips to the component that was added to this layout with the specified name, using addLayoutComponent. If no such component exists, then nothing happens.

Parameters:
container - the parent container in which to do the layout
name - the component name
See Also:
charva.awt.CardLayout#addLayoutComponent(java.awt.Component, java.lang.Object)

first

public void first(Container container)
Flips to the first card of the container.

Parameters:
container - the parent container in which to do the layout
See Also:
last(charva.awt.Container)

last

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

Parameters:
container - the parent container in which to do the layout
See Also:
first(charva.awt.Container)