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:Numberstatic public CENTER:Numberstatic public RIGHT:Numberpublic 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):VoidSets 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():NumberGets the horizontal gap between components.
the horizontal gap between components
public function setHgap(hgap:Number):VoidSets the horizontal gap between components.
hgap | the horizontal gap between components |
public function getVgap():NumberGets the vertical gap between components.
the vertical gap between components
public function setVgap(vgap:Number):VoidSets the vertical gap between components.
vgap | the vertical gap between components |
public function preferredLayoutSize(target:Container):DimensionReturns 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):DimensionReturns 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