|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.FlowLayout
public class FlowLayout
This class implements a flow-based layout. Components are laid out in order from left to right. When a component cannot be placed without horizontal clipping, a new row is started. This class supports horizontal and vertical gaps. These are used for spacing between components.
Field Summary | |
---|---|
static int |
CENTER
Constant that specifies center alignment. |
static int |
LEADING
Constant that specifies alignment to leading edge of container's orientation. |
static int |
LEFT
Constant that specifies left alignment. |
static int |
RIGHT
Constant that specifies right alignment. |
static int |
TRAILING
Constant that specifies alignment to trailing edge of container's orientation. |
Constructor Summary | |
---|---|
FlowLayout()
Initializes a new instance of FlowLayout with a center
justification and a default horizontal and vertical gap of 5. |
|
FlowLayout(int align)
Initializes a new instance of FlowLayout with the specified
justification and a default horizontal and vertical gap of 5. |
|
FlowLayout(int align,
int hgap,
int vgap)
Initializes a new instance of FlowLayout with the specified
justification and gap values |
Method Summary | |
---|---|
void |
addLayoutComponent(String name,
Component comp)
Add a new component to the layout. |
int |
getAlignment()
Returns the current justification value for this object. |
int |
getHgap()
Returns the horizontal gap between components. |
int |
getVgap()
Returns the vertical gap between lines of components. |
void |
layoutContainer(Container parent)
Lay out the container's components based on current settings. |
Dimension |
minimumLayoutSize(Container cont)
Returns the minimum layout size for the specified container using this layout. |
Dimension |
preferredLayoutSize(Container cont)
Returns the preferred layout size for the specified container using this layout. |
void |
removeLayoutComponent(Component comp)
Remove the indicated component from this layout manager. |
void |
setAlignment(int align)
Sets the justification value for this object to the specified value. |
void |
setHgap(int hgap)
Sets the horizontal gap between lines of components to the specified value. |
void |
setVgap(int vgap)
Sets the vertical gap between lines of components to the specified value. |
String |
toString()
Return String description of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int LEADING
public static final int TRAILING
Constructor Detail |
---|
public FlowLayout()
FlowLayout
with a center
justification and a default horizontal and vertical gap of 5.
public FlowLayout(int align)
FlowLayout
with the specified
justification and a default horizontal and vertical gap of 5.
align
- The justification setting, which should be one of the
contants in this class.public FlowLayout(int align, int hgap, int vgap)
FlowLayout
with the specified
justification and gap values
align
- Alignmenthgap
- The horizontal gapvgap
- The vertical gap
IllegalArgumentException
- If either gap is negativeMethod Detail |
---|
public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- the namecomp
- the componentpublic int getAlignment()
public int getHgap()
public int getVgap()
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- The parent containerpublic Dimension minimumLayoutSize(Container cont)
minimumLayoutSize
in interface LayoutManager
cont
- The parent container
LayoutManager.preferredLayoutSize(Container)
public Dimension preferredLayoutSize(Container cont)
preferredLayoutSize
in interface LayoutManager
cont
- The parent container
LayoutManager.minimumLayoutSize(Container)
public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
comp
- The component to removepublic void setAlignment(int align)
align
- The new justification value for this object, which must
be one of the constants in this class.public void setHgap(int hgap)
hgap
- The new horizontal gap between components.public void setVgap(int vgap)
vgap
- The new vertical gap.public 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 |