Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class FlowLayout  view FlowLayout download FlowLayout.java

java.lang.Object
  extended byjava.awt.FlowLayout
All Implemented Interfaces:
LayoutManager, java.io.Serializable

public class FlowLayout
extends java.lang.Object
implements LayoutManager, java.io.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.


Field Summary
private  int align
           
static int CENTER
          Constant that specifies center alignment.
private  int hgap
           
static int LEADING
          Constant that specifies alignment to leading edge of container's orientation.
static int LEFT
          Constant that specifies left alignment.
static int RIGHT
          Constant that specifies right alignment.
private static long serialVersionUID
           
static int TRAILING
          Constant that specifies alignment to trailing edge of container's orientation.
private  int vgap
           
 
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
 void addLayoutComponent(java.lang.String name, Component comp)
          Add a new component to the layout.
 int getAlignment()
          Returns the current justification value for this object.
 int getHgap()
          Returns the horizontal gap between components.
private  Dimension getSize(Container parent, boolean is_min)
           
 int getVgap()
          Returns the vertical gap between lines of components.
 void layoutContainer(Container parent)
          Lay out the container's components based on current settings.
 Dimension minimumLayoutSize(Container cont)
          Returns the minimum layout size for the specified container using this layout.
 Dimension preferredLayoutSize(Container cont)
          Returns the preferred layout size for the specified container using this layout.
 void removeLayoutComponent(Component comp)
          Remove the indicated component from this layout manager.
 void setAlignment(int align)
          Sets the justification value for this object to the specified value.
 void setHgap(int hgap)
          Sets the horizontal gap between components to the specified value.
 void setVgap(int vgap)
          Sets the vertical gap between lines of components to the specified value.
 java.lang.String toString()
          Return String description of this object.
 
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
Constant that specifies left alignment.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Constant that specifies center alignment.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Constant that specifies right alignment.

See Also:
Constant Field Values

LEADING

public static final int LEADING
Constant that specifies alignment to leading edge of container's orientation.

See Also:
Constant Field Values

TRAILING

public static final int TRAILING
Constant that specifies alignment to trailing edge of container's orientation.

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

align

private int align

hgap

private int hgap

vgap

private int vgap
Constructor Detail

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.


FlowLayout

public FlowLayout(int align,
                  int hgap,
                  int vgap)
Initializes a new instance of FlowLayout with the specified justification and gap values

Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               Component comp)
Add a new component to the layout. This particular implementation does nothing.

Specified by:
addLayoutComponent in interface LayoutManager

getAlignment

public int getAlignment()
Returns the current justification value for this object.


getHgap

public int getHgap()
Returns the horizontal gap between components.


getVgap

public int getVgap()
Returns the vertical gap between lines of components.


layoutContainer

public void layoutContainer(Container parent)
Lay out the container's components based on current settings.

Specified by:
layoutContainer in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container cont)
Returns the minimum layout size for the specified container using this layout.

Specified by:
minimumLayoutSize in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container cont)
Returns the preferred layout size for the specified container using this layout.

Specified by:
preferredLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Remove the indicated component from this layout manager. This particular implementation does nothing.

Specified by:
removeLayoutComponent in interface LayoutManager

setAlignment

public void setAlignment(int align)
Sets the justification value for this object to the specified value.


setHgap

public void setHgap(int hgap)
Sets the horizontal gap between components to the specified value.


setVgap

public void setVgap(int vgap)
Sets the vertical gap between lines of components to the specified value.


toString

public java.lang.String toString()
Return String description of this object.


getSize

private Dimension getSize(Container parent,
                          boolean is_min)