java.awt
Class FlowLayout

java.lang.Object
  |
  +--java.awt.FlowLayout
All Implemented Interfaces:
LayoutManager

public class FlowLayout
extends Object
implements LayoutManager

Flow layout is used to layout buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.


Field Summary
static int CENTER
          The right alignment variable.
static int LEFT
          The left alignment variable.
static int RIGHT
          The right alignment variable.
 
Constructor Summary
FlowLayout()
          Constructs a new Flow Layout with a centered alignment.
FlowLayout(int align)
          Constructs a new Flow Layout with the specified alignment.
FlowLayout(int align, int hgap, int vgap)
          Constructs a new Flow Layout with the specified alignment and gap values.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Adds the specified component to the layout.
 void layoutContainer(Container target)
          Lays out the container.
 Dimension minimumLayoutSize(Container target)
          Returns the minimum dimensions needed to layout the components contained in the specified target container.
 Dimension preferredLayoutSize(Container target)
          Returns the preferred dimensions for this layout given the components in the specified target container.
 void removeLayoutComponent(Component comp)
          Removes the specified component from the layout.
 String toString()
          Returns the String representation of this FlowLayout's values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
The left alignment variable.

See Also:
Constant Field Values

CENTER

public static final int CENTER
The right alignment variable.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
The right alignment variable.

See Also:
Constant Field Values
Constructor Detail

FlowLayout

public FlowLayout()
Constructs a new Flow Layout with a centered alignment.


FlowLayout

public FlowLayout(int align)
Constructs a new Flow Layout with the specified alignment.

Parameters:
align - the alignment value

FlowLayout

public FlowLayout(int align,
                  int hgap,
                  int vgap)
Constructs a new Flow Layout with the specified alignment and gap values.

Parameters:
align - the alignment value
hgap - the horizontal gap variable
vgap - the vertical gap variable
Method Detail

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Adds the specified component to the layout. Not used by this class.

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
name - the name of the component
comp - the the component to be added

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Removes the specified component from the layout. Not used by this class.

Specified by:
removeLayoutComponent in interface LayoutManager
Parameters:
comp - the component to remove

preferredLayoutSize

public Dimension preferredLayoutSize(Container target)
Returns the preferred dimensions for this layout given the components in the specified target container.

Specified by:
preferredLayoutSize in interface LayoutManager
Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public Dimension minimumLayoutSize(Container target)
Returns the minimum dimensions needed to layout the components contained in the specified target container.

Specified by:
minimumLayoutSize in interface LayoutManager
Parameters:
target - the component which needs to be laid out
See Also:
preferredLayoutSize(java.awt.Container)

layoutContainer

public void layoutContainer(Container target)
Lays out the container. This method will actually reshape the components in the target in order to satisfy the constraints of the BorderLayout object.

Specified by:
layoutContainer in interface LayoutManager
Parameters:
target - the specified component being laid out.
See Also:
Container

toString

public String toString()
Returns the String representation of this FlowLayout's values.

Overrides:
toString in class Object