dog.gui
Class VerticalFlowLayout

java.lang.Object
  |
  +--dog.gui.VerticalFlowLayout
All Implemented Interfaces:
java.awt.LayoutManager

public class VerticalFlowLayout
extends java.lang.Object
implements java.awt.LayoutManager

A vertical flow layout is used to lay out components in a panel. It will arrange the components from top to bottom until no more components fit in the same column. The columns can be aligned vertically.


Field Summary
static int BOTTOM
          The bottom alignment variable.
static int CENTER
          The centre alignment variable.
static int TOP
          The top alignment variable.
 
Constructor Summary
VerticalFlowLayout()
          Constructs a new layout with a centered alignment and a default 5-unit horizontal and vertical gap.
VerticalFlowLayout(int align)
          Constructs a new layout with the specified alignment and a default 5-unit horizontal and vertical gap.
VerticalFlowLayout(int align, int hgap, int vgap)
          Constructs a new layout with the specified alignment and gap values.
VerticalFlowLayout(int align, int hgap, int vgap, boolean maximise)
          Constructs a new layout with the specified alignment and gap values.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component to the layout.
 int getAlignment()
          Returns the alignment value for this layout (TOP, CENTER, or BOTTOM).
 int getHgap()
          Returns the horizontal gap between components.
 int getVgap()
          Returns the vertical gap between components.
 void layoutContainer(java.awt.Container target)
          Lays out the container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container target)
          Returns the minimum dimensions needed to layout the components contained in the specified target container.
 java.awt.Dimension preferredLayoutSize(java.awt.Container target)
          Returns the preferred dimensions for this layout given the components in the specified target container.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 void setAlignment(int align)
          Sets the alignment value for this layout.
 void setHgap(int hgap)
          Sets the horizontal gap between components.
 void setVgap(int vgap)
          Sets the vertical gap between components.
 java.lang.String toString()
          Returns the string representation of this layout's values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOP

public static final int TOP
The top alignment variable.

CENTER

public static final int CENTER
The centre alignment variable.

BOTTOM

public static final int BOTTOM
The bottom alignment variable.
Constructor Detail

VerticalFlowLayout

public VerticalFlowLayout()
Constructs a new layout with a centered alignment and a default 5-unit horizontal and vertical gap.

VerticalFlowLayout

public VerticalFlowLayout(int align)
Constructs a new layout with the specified alignment and a default 5-unit horizontal and vertical gap.
Parameters:
align - the alignment value

VerticalFlowLayout

public VerticalFlowLayout(int align,
                          int hgap,
                          int vgap)
Constructs a new layout with the specified alignment and gap values.
Parameters:
align - the alignment value
hgap - the horizontal gap variable
vgap - the vertical gap variable

VerticalFlowLayout

public VerticalFlowLayout(int align,
                          int hgap,
                          int vgap,
                          boolean maximise)
Constructs a new 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

getAlignment

public int getAlignment()
Returns the alignment value for this layout (TOP, CENTER, or BOTTOM).

setAlignment

public void setAlignment(int align)
Sets the alignment value for this layout.
Parameters:
align - the alignment value (TOP, CENTER, or BOTTOM).

getHgap

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

setHgap

public void setHgap(int hgap)
Sets the horizontal gap between components.
Parameters:
hgap - the horizontal gap between components

getVgap

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

setVgap

public void setVgap(int vgap)
Sets the vertical gap between components.
Parameters:
vgap - the vertical gap between components

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds the specified component to the layout. Not used by this class.
Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the name of the component
comp - the the component to be added

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. Not used by this class.
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - the component to remove

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout given the components in the specified target container.
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
Returns the minimum dimensions needed to layout the components contained in the specified target container.
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
target - the component which needs to be laid out
See Also:
preferredLayoutSize(java.awt.Container)

layoutContainer

public void layoutContainer(java.awt.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 java.awt.LayoutManager
Parameters:
target - the specified component being laid out.
See Also:
Container

toString

public java.lang.String toString()
Returns the string representation of this layout's values.
Overrides:
toString in class java.lang.Object