|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.CardLayout
public class CardLayout
This class implements a card-based layout scheme. Each included component is treated as a card. Only one card can be shown at a time. This class includes methods for changing which card is shown.
Constructor Summary | |
---|---|
CardLayout()
Initializes a new instance of CardLayout with horizontal
and vertical gaps of 0. |
|
CardLayout(int hgap,
int vgap)
Create a new CardLayout object with the specified
horizontal and vertical gaps. |
Method Summary | |
---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Add a new component to the layout. |
void |
addLayoutComponent(String name,
Component comp)
Deprecated. This method is deprecated in favor of addLayoutComponent(Component, Object) . |
void |
first(Container parent)
Cause the first component in the container to be displayed. |
int |
getHgap()
Return this layout manager's horizontal gap. |
float |
getLayoutAlignmentX(Container parent)
Return this layout manager's x alignment. |
float |
getLayoutAlignmentY(Container parent)
Returns this layout manager's y alignment. |
int |
getVgap()
Return this layout manager's vertical gap. |
void |
invalidateLayout(Container target)
Invalidate this layout manager's state. |
void |
last(Container parent)
Cause the last component in the container to be displayed. |
void |
layoutContainer(Container parent)
Lays out the container. |
Dimension |
maximumLayoutSize(Container target)
Get the maximum layout size of the container. |
Dimension |
minimumLayoutSize(Container target)
Get the minimum layout size of the container. |
void |
next(Container parent)
Cause the next component in the container to be displayed. |
Dimension |
preferredLayoutSize(Container parent)
Get the preferred layout size of the container. |
void |
previous(Container parent)
Cause the previous component in the container to be displayed. |
void |
removeLayoutComponent(Component comp)
Remove the indicated component from this layout manager. |
void |
setHgap(int hgap)
Set this layout manager's horizontal gap. |
void |
setVgap(int vgap)
Set this layout manager's vertical gap. |
void |
show(Container parent,
String name)
Cause the named component to be shown. |
String |
toString()
Returns a string representation of this layout manager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CardLayout()
CardLayout
with horizontal
and vertical gaps of 0.
public CardLayout(int hgap, int vgap)
CardLayout
object with the specified
horizontal and vertical gaps.
hgap
- The horizontal gapvgap
- The vertical gapMethod Detail |
---|
public void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
comp
- The component to addconstraints
- The name by which the component can later be called
IllegalArgumentException
- If `constraints' is not a
String
public void addLayoutComponent(String name, Component comp)
addLayoutComponent(Component, Object)
.
addLayoutComponent
in interface LayoutManager
name
- The name by which the component can later be calledcomp
- The component to addpublic void first(Container parent)
parent
- The parent container, not null
.public int getHgap()
public float getLayoutAlignmentX(Container parent)
getLayoutAlignmentX
in interface LayoutManager2
parent
- Container using this layout manager instance
public float getLayoutAlignmentY(Container parent)
getLayoutAlignmentY
in interface LayoutManager2
parent
- Container using this layout manager instance
public int getVgap()
public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
target
- the target containerpublic void last(Container parent)
parent
- The parent container, not null
.public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- The parent container.public Dimension maximumLayoutSize(Container target)
maximumLayoutSize
in interface LayoutManager2
target
- The parent container
Component.getMaximumSize()
public Dimension minimumLayoutSize(Container target)
minimumLayoutSize
in interface LayoutManager
target
- The parent container
LayoutManager.preferredLayoutSize(Container)
public void next(Container parent)
parent
- The parent container, not null
.public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
parent
- The parent container
LayoutManager.minimumLayoutSize(Container)
public void previous(Container parent)
parent
- The parent container, not null
.public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
comp
- The component to removepublic void setHgap(int hgap)
hgap
- The new gappublic void setVgap(int vgap)
vgap
- The new gappublic void show(Container parent, String name)
null
, this method does nothing.
parent
- The parent container, not null
.name
- The name of the component to showpublic String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |