org.jhotdraw.gui
Class ToolBarLayout

java.lang.Object
  extended by org.jhotdraw.gui.ToolBarLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable

public class ToolBarLayout
extends java.lang.Object
implements java.awt.LayoutManager2, java.io.Serializable

A layout which lays out components horizontally or vertically according to their preferred size.

Author:
Werner Randelshofer  @version $Id: ToolBarLayout.java 527 2009-06-07 14:28:19Z rawcoder $
See Also:
Serialized Form

Field Summary
private  int axis
          Specifies the axis of the layout.
static int X_AXIS
          Specifies that components should be laid out left to right.
static int Y_AXIS
          Specifies that components should be laid out top to bottom.
 
Constructor Summary
ToolBarLayout()
          Creates a layout manager that will lay out components along the X-axis.
ToolBarLayout(int axis)
          Creates a layout manager that will lay out components along the given axis.
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
           
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
           
 float getLayoutAlignmentX(java.awt.Container target)
           
 float getLayoutAlignmentY(java.awt.Container target)
           
 void invalidateLayout(java.awt.Container target)
           
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension maximumLayoutSize(java.awt.Container target)
           
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
Specifies that components should be laid out left to right.

See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
Specifies that components should be laid out top to bottom.

See Also:
Constant Field Values

axis

private int axis
Specifies the axis of the layout.

Constructor Detail

ToolBarLayout

public ToolBarLayout()
Creates a layout manager that will lay out components along the X-axis.


ToolBarLayout

public ToolBarLayout(int axis)
Creates a layout manager that will lay out components along the given axis.

Parameters:
axis - the axis to lay out components along. Can be one of: BoxLayout.X_AXIS, BoxLayout.Y_AXIS,
Throws:
java.awt.AWTError - if the value of axis is invalid
Method Detail

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object constraints)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager2

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Specified by:
invalidateLayout in interface java.awt.LayoutManager2

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager

layoutContainer

public void layoutContainer(java.awt.Container parent)
Specified by:
layoutContainer in interface java.awt.LayoutManager