Class org.aswing.FlowLayout

Description

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.

Field Index

CENTER, LEFT, RIGHT

Method Index

new FlowLayout()
getAlignment(), getHgap(), getVgap(), layoutContainer(), minimumLayoutSize(), preferredLayoutSize(), setAlignment(), setHgap(), setVgap(), toString()

Inherited from EmptyLayout

Constructor Detail

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.

Parameters

alignthe alignment value, default is LEFT
hgapthe horizontal gap between components, default 5
vgapthe vertical gap between components, default 5

Field Detail

LEFT

static public LEFT:Number
This value indicates that each row of components should be left-justified.

CENTER

static public CENTER:Number
This value indicates that each row of components should be centered.

RIGHT

static public RIGHT:Number
This value indicates that each row of components should be right-justified.

Method Detail

getAlignment

public function getAlignment():Number

Gets the alignment for this layout. Possible values are FlowLayout.LEFT, FlowLayout.RIGHT, FlowLayout.CENTER,

Return

the alignment value for this layout

See Also

setAlignment

public function setAlignment(align:Number):Void

Sets the alignment for this layout. Possible values are

  • FlowLayout.LEFT
  • FlowLayout.RIGHT
  • FlowLayout.CENTER

Parameters

alignone of the alignment values shown above

See Also

getHgap

public function getHgap():Number

Gets the horizontal gap between components.

Return

the horizontal gap between components

See Also

setHgap

public function setHgap(hgap:Number):Void

Sets the horizontal gap between components.

Parameters

hgapthe horizontal gap between components

See Also

getVgap

public function getVgap():Number

Gets the vertical gap between components.

Return

the vertical gap between components

See Also

setVgap

public function setVgap(vgap:Number):Void

Sets the vertical gap between components.

Parameters

vgapthe vertical gap between components

See Also

preferredLayoutSize

public function preferredLayoutSize(target:Container):Dimension

Returns the preferred dimensions for this layout given the visible components in the specified target container.

Parameters

targetthe component which needs to be laid out

Return

the preferred dimensions to lay out the subcomponents of the specified container

Specified By

preferredLayoutSize() in org.aswing.LayoutManager

Overrides

preferredLayoutSize() in org.aswing.EmptyLayout

See Also

minimumLayoutSize

public function minimumLayoutSize(target:Container):Dimension

Returns the minimum dimensions needed to layout the visible components contained in the specified target container.

Parameters

targetthe component which needs to be laid out

Return

the minimum dimensions to lay out the subcomponents of the specified container

Specified By

minimumLayoutSize() in org.aswing.LayoutManager

Overrides

minimumLayoutSize() in org.aswing.EmptyLayout

See Also

layoutContainer

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.

Parameters

targetthe specified component being laid out

Specified By

layoutContainer() in org.aswing.LayoutManager

Overrides

layoutContainer() in org.aswing.EmptyLayout

See Also

toString

public function toString():String

Returns a string representation of this FlowLayout object and its values.

Return

a string representation of this layout