public class VerticalFlowLayout
extends java.lang.Object
implements java.awt.LayoutManager, java.io.Serializable
限定符和类型 | 字段和说明 |
---|---|
static int |
BOTTOM
This value indicates that each row of components
should be right-justified.
|
static int |
CENTER
This value indicates that each row of components
should be centered.
|
protected int |
hgap
The flow layout manager allows a seperation of
components with gaps.
|
static int |
TOP
This value indicates that each row of components
should be left-justified.
|
protected int |
vgap
The flow layout manager allows a seperation of
components with gaps.
|
构造器和说明 |
---|
VerticalFlowLayout()
Constructs a new
FlowLayout with a centered alignment and a
default 5-unit horizontal and vertical gap. |
VerticalFlowLayout(int align)
Constructs a new
FlowLayout with the specified
alignment and a default 5-unit horizontal and vertical gap. |
VerticalFlowLayout(int align,
int hgap,
int vgap)
Creates a new flow layout manager with the indicated alignment
and the indicated horizontal and vertical gaps.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Adds the specified component to the layout.
|
protected int[] |
dealWithDim4LayoutContainer(java.awt.Container target,
java.awt.Insets insets,
java.awt.Dimension d,
int x,
int y,
int roww,
int start,
int maxlen,
int i,
boolean ltr) |
protected void |
dealWithMC4LayoutContainer(java.awt.Container target,
java.awt.Insets insets,
int x,
int y,
int roww,
int start,
int maxlen,
int nmembers,
boolean ltr) |
protected boolean |
dialWithDim4MinimumLayoutSize(java.awt.Dimension dim,
java.awt.Dimension d,
int i,
boolean firstVisibleComponent) |
protected boolean |
dialWithDim4PreferredLayoutSize(java.awt.Dimension dim,
java.awt.Dimension d,
boolean firstVisibleComponent) |
int |
getAlignment()
Gets the alignment for this layout.
|
int |
getHgap()
Gets the horizontal gap between components.
|
protected int |
getMaxLen4LayoutContainer(java.awt.Container target,
java.awt.Insets insets) |
protected java.awt.Dimension |
getPreferredSize(java.awt.Container target,
java.awt.Component m) |
int |
getVgap()
Gets the vertical gap between components.
|
protected int |
getX4LayoutContainer(java.awt.Insets insets) |
protected int |
getY4LayoutContainer(java.awt.Insets insets) |
void |
layoutContainer(java.awt.Container target)
Lays out the container.
|
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target)
Returns the minimum dimensions needed to layout the visible
components contained in the specified target container.
|
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout given the
visible components in the specified target container.
|
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout.
|
void |
setAlignLeft(boolean isAlignLeft)
当列宽不一致时,通过此方法设置是否需要左对齐
|
void |
setAlignment(int align)
Sets the alignment for this layout.
|
void |
setHgap(int hgap)
Sets the horizontal gap between components.
|
void |
setVgap(int vgap)
Sets the vertical gap between components.
|
java.lang.String |
toString()
Returns a string representation of this
FlowLayout
object and its values. |
public static final int TOP
public static final int CENTER
public static final int BOTTOM
protected int hgap
getHgap()
,
setHgap(int)
protected int vgap
getHgap()
,
setHgap(int)
public VerticalFlowLayout()
FlowLayout
with a centered alignment and a
default 5-unit horizontal and vertical gap.public VerticalFlowLayout(int align)
FlowLayout
with the specified
alignment and a default 5-unit horizontal and vertical gap.
The value of the alignment argument must be one of
FlowLayout.TOP
, FlowLayout.BOTTOM
,
or FlowLayout.CENTER
.align
- the alignment valuepublic VerticalFlowLayout(int align, int hgap, int vgap)
FlowLayout.TOP
, FlowLayout.BOTTOM
,
or FlowLayout.CENTER
.align
- the alignment valuehgap
- the horizontal gap between componentsvgap
- the vertical gap between componentspublic int getAlignment()
FlowLayout.TOP
,
FlowLayout.BOTTOM
, FlowLayout.CENTER
,
FlowLayout.LEADING
,
or FlowLayout.TRAILING
.FlowLayout.setAlignment(int)
public void setAlignment(int align)
FlowLayout.TOP
FlowLayout.BOTTOM
FlowLayout.CENTER
FlowLayout.LEADING
FlowLayout.TRAILING
align
- one of the alignment values shown abovegetAlignment()
public int getHgap()
FlowLayout.setHgap(int)
public void setHgap(int hgap)
hgap
- the horizontal gap between componentsFlowLayout.getHgap()
public int getVgap()
FlowLayout.setVgap(int)
public void setVgap(int vgap)
vgap
- the vertical gap between componentsFlowLayout.getVgap()
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
在接口中 java.awt.LayoutManager
name
- the name of the componentcomp
- the component to be addedpublic void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
在接口中 java.awt.LayoutManager
comp
- the component to removeContainer.removeAll()
public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
preferredLayoutSize
在接口中 java.awt.LayoutManager
target
- the component which needs to be laid outContainer
,
minimumLayoutSize(java.awt.Container)
,
Container.getPreferredSize()
protected boolean dialWithDim4PreferredLayoutSize(java.awt.Dimension dim, java.awt.Dimension d, boolean firstVisibleComponent)
public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
minimumLayoutSize
在接口中 java.awt.LayoutManager
target
- the component which needs to be laid outpreferredLayoutSize(java.awt.Container)
,
Container
,
Container.doLayout()
protected boolean dialWithDim4MinimumLayoutSize(java.awt.Dimension dim, java.awt.Dimension d, int i, boolean firstVisibleComponent)
public void layoutContainer(java.awt.Container target)
FlowLayout
object.layoutContainer
在接口中 java.awt.LayoutManager
target
- the specified component being laid outContainer
,
Container.doLayout()
protected java.awt.Dimension getPreferredSize(java.awt.Container target, java.awt.Component m)
protected void dealWithMC4LayoutContainer(java.awt.Container target, java.awt.Insets insets, int x, int y, int roww, int start, int maxlen, int nmembers, boolean ltr)
protected int[] dealWithDim4LayoutContainer(java.awt.Container target, java.awt.Insets insets, java.awt.Dimension d, int x, int y, int roww, int start, int maxlen, int i, boolean ltr)
protected int getMaxLen4LayoutContainer(java.awt.Container target, java.awt.Insets insets)
protected int getX4LayoutContainer(java.awt.Insets insets)
protected int getY4LayoutContainer(java.awt.Insets insets)
public void setAlignLeft(boolean isAlignLeft)
public java.lang.String toString()
FlowLayout
object and its values.toString
在类中 java.lang.Object