Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class FlowLayout

java.lang.Object
|
+--java.awt.FlowLayout

All Implemented Interfaces:

LayoutManager, Serializable


public class FlowLayout

extends Object

implements LayoutManager, Serializable

This class implements a flow-based layout. Components are laid out in order from left to right. When a component cannot be placed without horizontal clipping, a new row is started. This class supports horizontal and vertical gaps. These are used for spacing between components.

Authors:

Field Summary

static intCENTER

Constant that specifies center alignment.
static intLEADING

Constant that specifies alignment to leading edge of container's orientation.
static intLEFT

Constant that specifies left alignment.
static intRIGHT

Constant that specifies right alignment.
static intTRAILING

Constant that specifies alignment to trailing edge of container's orientation.

Constructor Summary

FlowLayout()

Initializes a new instance of FlowLayout with a center justification and a default horizontal and vertical gap of 5.
FlowLayout(int align)

Initializes a new instance of FlowLayout with the specified justification and a default horizontal and vertical gap of 5.
FlowLayout(int align, int hgap, int vgap)

Initializes a new instance of FlowLayout with the specified justification and gap values

Method Summary

voidaddLayoutComponent(java.lang.String name, java.awt.Component comp)

Add a new component to the layout.
intgetAlignment()

Returns the current justification value for this object.
intgetHgap()

Returns the horizontal gap between components.
intgetVgap()

Returns the vertical gap between lines of components.
voidlayoutContainer(java.awt.Container parent)

Lay out the container's components based on current settings.
java.awt.DimensionminimumLayoutSize(java.awt.Container cont)

Returns the minimum layout size for the specified container using this layout.
java.awt.DimensionpreferredLayoutSize(java.awt.Container cont)

Returns the preferred layout size for the specified container using this layout.
voidremoveLayoutComponent(java.awt.Component comp)

Remove the indicated component from this layout manager.
voidsetAlignment(int align)

Sets the justification value for this object to the specified value.
voidsetHgap(int hgap)

Sets the horizontal gap between components to the specified value.
voidsetVgap(int vgap)

Sets the vertical gap between lines of components to the specified value.
java.lang.StringtoString()

Return String description of this object.

Field Details

CENTER

public static final int CENTER

Constant that specifies center alignment.


LEADING

public static final int LEADING

Constant that specifies alignment to leading edge of container's orientation.


LEFT

public static final int LEFT

Constant that specifies left alignment.


RIGHT

public static final int RIGHT

Constant that specifies right alignment.


TRAILING

public static final int TRAILING

Constant that specifies alignment to trailing edge of container's orientation.


Constructor Details

FlowLayout

public FlowLayout()

Initializes a new instance of FlowLayout with a center justification and a default horizontal and vertical gap of 5.


FlowLayout

public FlowLayout(int align)

Initializes a new instance of FlowLayout with the specified justification and a default horizontal and vertical gap of 5.

Parameters:


FlowLayout

public FlowLayout(int align, int hgap, int vgap)

Initializes a new instance of FlowLayout with the specified justification and gap values

Parameters:

Throws:


Method Details

addLayoutComponent

public void addLayoutComponent(java.lang.String name, java.awt.Component comp)

Add a new component to the layout. This particular implementation does nothing.

Parameters:


getAlignment

public int getAlignment()

Returns the current justification value for this object.

Returns:


getHgap

public int getHgap()

Returns the horizontal gap between components.

Returns:


getVgap

public int getVgap()

Returns the vertical gap between lines of components.

Returns:


layoutContainer

public void layoutContainer(java.awt.Container parent)

Lay out the container's components based on current settings.

Parameters:


minimumLayoutSize

public Dimension minimumLayoutSize(java.awt.Container cont)

Returns the minimum layout size for the specified container using this layout.

Parameters:

Returns:


preferredLayoutSize

public Dimension preferredLayoutSize(java.awt.Container cont)

Returns the preferred layout size for the specified container using this layout.

Parameters:

Returns:


removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)

Remove the indicated component from this layout manager. This particular implementation does nothing.

Parameters:


setAlignment

public void setAlignment(int align)

Sets the justification value for this object to the specified value.

Parameters:


setHgap

public void setHgap(int hgap)

Sets the horizontal gap between components to the specified value.

Parameters:


setVgap

public void setVgap(int vgap)

Sets the vertical gap between lines of components to the specified value.

Parameters:


toString

public String toString()

Return String description of this object.

Returns: