A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. Flow layouts are typically used to arrange buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.
For example, the following picture shows an applet using the flow layout manager (its default layout manager) to position three buttons:
A flow layout lets each component assume its natural (preferred) size.
new FlowLayout()
public function FlowLayout(align:Number, hgap:Number, vgap:Number)
Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.
The value of the alignment argument must be one of
FlowLayout.LEFT
, FlowLayout.RIGHT
,
or FlowLayout.CENTER
.
align | the alignment value, default is LEFT |
hgap | the horizontal gap between components, default 5 |
vgap | the vertical gap between components, default 5 |
static public LEFT:Number
static public CENTER:Number
static public RIGHT:Number
public function getAlignment():Number
Gets the alignment for this layout.
Possible values are FlowLayout.LEFT
,
FlowLayout.RIGHT
, FlowLayout.CENTER
,
the alignment value for this layout
public function setAlignment(align:Number):Void
Sets the alignment for this layout. Possible values are
FlowLayout.LEFT
FlowLayout.RIGHT
FlowLayout.CENTER
align | one of the alignment values shown above |
public function getHgap():Number
Gets the horizontal gap between components.
the horizontal gap between components
public function setHgap(hgap:Number):Void
Sets the horizontal gap between components.
hgap | the horizontal gap between components |
public function getVgap():Number
Gets the vertical gap between components.
the vertical gap between components
public function setVgap(vgap:Number):Void
Sets the vertical gap between components.
vgap | the vertical gap between components |
public function preferredLayoutSize(target:Container):Dimension
Returns the preferred dimensions for this layout given the visible components in the specified target container.
target | the component which needs to be laid out |
the preferred dimensions to lay out the subcomponents of the specified container
preferredLayoutSize() in org.aswing.LayoutManager
preferredLayoutSize() in org.aswing.EmptyLayout
public function minimumLayoutSize(target:Container):Dimension
Returns the minimum dimensions needed to layout the visible components contained in the specified target container.
target | the component which needs to be laid out |
the minimum dimensions to lay out the subcomponents of the specified container
minimumLayoutSize() in org.aswing.LayoutManager
minimumLayoutSize() in org.aswing.EmptyLayout
public function layoutContainer(target:Container):Void
Lays out the container. This method lets each component take
its preferred size by reshaping the components in the
target container in order to satisfy the alignment of
this FlowLayout
object.
target | the specified component being laid out |
layoutContainer() in org.aswing.LayoutManager
layoutContainer() in org.aswing.EmptyLayout