charva.awt

Class FlowLayout

Implemented Interfaces:
LayoutManager

public class FlowLayout
extends java.lang.Object
implements LayoutManager

A concrete implementation of LayoutManager that lays out its components left-to-right.

Field Summary

static int
CENTER
static int
LEFT
static int
RIGHT

Constructor Summary

FlowLayout()
Default constructor.
FlowLayout(int align_, int hgap_, int vgap_)
Use this constructor when you want to set the alignment and the horizontal and vertical gaps.

Method Summary

void
doLayout(Container container_)
Lay out the components according to the specified alignment, hgap and vgap.
int
getAlignment()
Gets the alignment for this layout.
Dimension
minimumSize(Container container_)
Calculate the minimum-size rectangle that can enclose all the components in the given container.
void
setAlignment(int align_)
Sets the alignment for this layout.

Field Details

CENTER

public static final int CENTER
Field Value:
2

LEFT

public static final int LEFT
Field Value:
1

RIGHT

public static final int RIGHT
Field Value:
3

Constructor Details

FlowLayout

public FlowLayout()
Default constructor. Sets alignment to CENTER, hgap to 1, and vgap to 0.

FlowLayout

public FlowLayout(int align_,
                  int hgap_,
                  int vgap_)
Use this constructor when you want to set the alignment and the horizontal and vertical gaps.

Method Details

doLayout

public void doLayout(Container container_)
Lay out the components according to the specified alignment, hgap and vgap. This is called when the size of the container has already been calculated. It lays out the components in a row, one at a time, until it determines that there is not enough space left in the row. Then it moves to the next row. If there is not enough vertical space in the container to lay out all of the components, it removes the remaining components from the container; they don't appear at all.
Specified by:
doLayout in interface LayoutManager

getAlignment

public int getAlignment()
Gets the alignment for this layout.

minimumSize

public Dimension minimumSize(Container container_)
Calculate the minimum-size rectangle that can enclose all the components in the given container.
Specified by:
minimumSize in interface LayoutManager

setAlignment

public void setAlignment(int align_)
Sets the alignment for this layout. Allowable values are FlowLayout.LEFT, FlowLayout.CENTER and FlowLayout.RIGHT.