|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class CardLayout

java.lang.Objectjava.awt.CardLayout
- All Implemented Interfaces:
- LayoutManager, LayoutManager2, java.io.Serializable
- public class CardLayout
- extends java.lang.Object
- implements LayoutManager2, java.io.Serializable
- extends java.lang.Object
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.
| Field Summary | |
private static int |
FIRST
|
private int |
hgap
|
private static int |
LAST
|
private static int |
MAX
|
private static int |
MIN
|
private static int |
NEXT
|
private static int |
PREF
|
private static int |
PREV
|
private static long |
serialVersionUID
|
private java.util.Hashtable |
tab
|
private int |
vgap
|
| 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,
java.lang.Object constraints)
Add a new component to the layout. |
void |
addLayoutComponent(java.lang.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. |
private Dimension |
getSize(Container parent,
int what)
|
int |
getVgap()
Return this layout manager's vertical gap. |
private void |
gotoComponent(Container parent,
int what)
This implements first(), last(), next(), and previous(). |
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,
java.lang.String name)
Cause the named component to be shown. |
java.lang.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 |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
hgap
private int hgap
vgap
private int vgap
tab
private java.util.Hashtable tab
FIRST
private static final int FIRST
- See Also:
- Constant Field Values
LAST
private static final int LAST
- See Also:
- Constant Field Values
NEXT
private static final int NEXT
- See Also:
- Constant Field Values
PREV
private static final int PREV
- See Also:
- Constant Field Values
MIN
private static final int MIN
- See Also:
- Constant Field Values
MAX
private static final int MAX
- See Also:
- Constant Field Values
PREF
private static final int PREF
- See Also:
- Constant Field Values
| Constructor Detail |
CardLayout
public CardLayout()
- Initializes a new instance of
CardLayoutwith horizontal and vertical gaps of 0.
CardLayout
public CardLayout(int hgap,
int vgap)
- Create a new
CardLayoutobject with the specified horizontal and vertical gaps.
| Method Detail |
addLayoutComponent
public void addLayoutComponent(Component comp, java.lang.Object constraints)
- Add a new component to the layout. The constraint must be a
string which is used to name the component. This string can
later be used to refer to the particular component.
- Specified by:
addLayoutComponentin interfaceLayoutManager2
addLayoutComponent
public void addLayoutComponent(java.lang.String name, Component comp)
- Deprecated. This method is deprecated in favor of
addLayoutComponent(Component, Object).- Add a new component to the layout. The name can be used later to refer to the component.
- Specified by:
addLayoutComponentin interfaceLayoutManager
- Add a new component to the layout. The name can be used later to refer to the component.
first
public void first(Container parent)
- Cause the first component in the container to be displayed.
getHgap
public int getHgap()
- Return this layout manager's horizontal gap.
getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)
- Return this layout manager's x alignment. This method always
returns Component.CENTER_ALIGNMENT.
- Specified by:
getLayoutAlignmentXin interfaceLayoutManager2
getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)
- Returns this layout manager's y alignment. This method always
returns Component.CENTER_ALIGNMENT.
- Specified by:
getLayoutAlignmentYin interfaceLayoutManager2
getVgap
public int getVgap()
- Return this layout manager's vertical gap.
invalidateLayout
public void invalidateLayout(Container target)
- Invalidate this layout manager's state.
- Specified by:
invalidateLayoutin interfaceLayoutManager2
last
public void last(Container parent)
- Cause the last component in the container to be displayed.
layoutContainer
public void layoutContainer(Container parent)
- Lays out the container. This is done by resizing the child components
to be the same size as the parent, less insets and gaps.
- Specified by:
layoutContainerin interfaceLayoutManager
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
- Get the maximum layout size of the container.
- Specified by:
maximumLayoutSizein interfaceLayoutManager2
minimumLayoutSize
public Dimension minimumLayoutSize(Container target)
- Get the minimum layout size of the container.
- Specified by:
minimumLayoutSizein interfaceLayoutManager
next
public void next(Container parent)
- Cause the next component in the container to be displayed. If
this current card is the last one in the deck, the first
component is displayed.
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
- Get the preferred layout size of the container.
- Specified by:
preferredLayoutSizein interfaceLayoutManager
previous
public void previous(Container parent)
- Cause the previous component in the container to be displayed.
If this current card is the first one in the deck, the last
component is displayed.
removeLayoutComponent
public void removeLayoutComponent(Component comp)
- Remove the indicated component from this layout manager.
- Specified by:
removeLayoutComponentin interfaceLayoutManager
setHgap
public void setHgap(int hgap)
- Set this layout manager's horizontal gap.
setVgap
public void setVgap(int vgap)
- Set this layout manager's vertical gap.
show
public void show(Container parent, java.lang.String name)
- Cause the named component to be shown. If the component name is
unknown or
null, this method does nothing.
toString
public java.lang.String toString()
- Returns a string representation of this layout manager.
gotoComponent
private void gotoComponent(Container parent, int what)
- This implements first(), last(), next(), and previous().
getSize
private Dimension getSize(Container parent, int what)
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.awt.CardLayout