The CardLayout LayoutManager provides the means to manage multiple components, displaying one at a time. Components are displayed in the order in which they are added to the layout, or in an arbitrary order by using an assignable name.
public class java.awt.CardLayout extends java.lang.Object implements java.awt.LayoutManager2, java.io.Serializable { // Constructors public CardLayout(); public CardLayout (int hgap, int vgap); // Instance Methods public void addLayoutComponent (Component comp, Object constraints); public void addLayoutComponent (String name, Component component); public void first (Container parent); public int getHgap(); public abstract float getLayoutAlignmentX(Container target); public abstract float getLayoutAlignmentY(Container target); public int getVgap(); public abstract void invalidateLayout(Container target); public void last (Container parent); public void layoutContainer (Container target); public abstract Dimension maximumLayoutSize(Container target); public Dimension minimumLayoutSize (Container target); public void next (Container parent); public Dimension preferredLayoutSize (Container target); public void previous (Container parent); public void removeLayoutComponent (Component component); public void setHgap (int hgap); public void setVgap (int vgap); public void show (Container parent, String name); public String toString(); }
Constructs a CardLayout object.
Horizontal space around left and right of container
Vertical space around top and bottom of container
Constructs a CardLayout object with the values specified as the gaps around the container managed by this instance of CardLayout.
The component being added.
An object describing the constraints on this component.
LayoutManager2.addLayoutComponent()
Adds the component comp to a container subject to the given constraints. This is a more generalized version of addLayoutComponent(String, Component). It corresponds to java.awt.Container's add(Component, Object). In practice, it is used the same in Java 1.1 as in Java 1.0.2, except with the parameters swapped:
Panel p = new Panel(); p.setLayoutManager(new CardLayout()); p.add(new Button("OK"), "Don Julio");
Name of the component to add.
The actual component being added.
LayoutManager.addLayoutComponent()
Places component under the layout's management, assigning it the given name. This has been replaced in version 1.1 with the more general addLayoutComponent(Component, Object).
The container whose displayed component is changing.
If the LayoutManager of parent is not CardLayout.
Sets the container to display the first component in parent.
The horizontal gap for this CardLayout instance.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is left aligned, .5 is centered, and 1 is right aligned.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is top aligned, .5 is centered, and 1 is bottom aligned.
The vertical gap for this CardLayout instance.
The container to invalidate.
Does nothing.
The container whose displayed component is changing.
If the LayoutManager of parent is not CardLayout.
Sets the container to display the final component in parent.
The container that needs to be redrawn.
LayoutManager.layoutContainer()
Displays the currently selected component contained within target.
The container to inspect.
A Dimension whose horizontal and vertical components are Integer.MAX_VALUE.
For CardLayout, a maximal Dimension is always returned.
The container whose size needs to be calculated.
Minimum Dimension of the container target.
LayoutManager.minimumLayoutSize()
Calculates minimum size of the target container.
The container whose displayed component is changing.
If the LayoutManager of parent is not CardLayout.
Sets the container to display the following component in the parent.
The container whose size needs to be calculated.
Preferred Dimension of the container target.
LayoutManager.preferredLayoutSize()
Calculates preferred size of the target container.
The container whose displayed component is changing.
If the LayoutManager of parent is not CardLayout.
Sets the container to display the prior component in parent.
Component to stop tracking.
LayoutManager.removeLayoutComponent()
Removes component from the layout manager's internal tables.
The horizontal gap value.
Sets the horizontal gap for the left and right of the container.
The vertical gap value.
Sets the vertical gap for the top and bottom of the container.
The container whose displayed component is changing.
Name of component to display.
If LayoutManager of parent is not CardLayout.
Sets the container to display the component name in parent.
A string representation of the CardLayout object.
Object.toString()
Component, Container, Dimension, LayoutManager, LayoutManager2, Object, String
This HTML Help has been published using the chm2web software. |