ch.javasoft.swing
Class StretchGridLayout

java.lang.Object
  extended by ch.javasoft.swing.StretchGridLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2

public class StretchGridLayout
extends Object
implements LayoutManager2

A LayoutManager2 that arranges the components in a grid. The row heights and column widths are determined by the minimum, preferred and maximum sizes of the contained components.
Legal layout constraints are enumerated in Constraint

Author:
pesche

Nested Class Summary
static class StretchGridLayout.Constraint
          Constraint to use when adding a component to a container.
static class StretchGridLayout.LinearFunction
           
static class StretchGridLayout.Mode
           
static class StretchGridLayout.Pair<S,T>
           
static class StretchGridLayout.StueckLinFunction
          A stueckweise lineare Funktion.
 
Constructor Summary
StretchGridLayout(StretchGridLayout.Mode mode, int count)
          StretchGridLayout constructor:
StretchGridLayout(StretchGridLayout.Mode mode, int count, int gapRows, int gapColumns)
          StretchGridLayout constructor:
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
          If mode is MODE_FIXED_COLUMNS, then the components are filled in row by row.
If mode is MODE_FIXED_ROWS, then the components are filled in column by column.
 void addLayoutComponent(String name, Component comp)
          Adds a component with resize constraints StretchGridLayout.Constraint.STRETCH_BOTH
 float getLayoutAlignmentX(Container target)
           
 float getLayoutAlignmentY(Container target)
           
 void invalidateLayout(Container target)
           
 void layoutContainer(Container parent)
           
 Dimension maximumLayoutSize(Container target)
           
 Dimension minimumLayoutSize(Container parent)
           
 Dimension preferredLayoutSize(Container parent)
           
 void removeLayoutComponent(Component comp)
           
 void setLayoutAlignmentX(float ax)
           
 void setLayoutAlignmentY(float ay)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StretchGridLayout

public StretchGridLayout(StretchGridLayout.Mode mode,
                         int count)
StretchGridLayout constructor:

Parameters:
mode - Determines if the number of rows or the number of columns is fixed
count - The number of rows or the number of columns, depending on selected mode (must be > 0)

StretchGridLayout

public StretchGridLayout(StretchGridLayout.Mode mode,
                         int count,
                         int gapRows,
                         int gapColumns)
StretchGridLayout constructor:

Parameters:
mode - Determines if the number of rows or the number of columns is fixed
count - The number of rows or the number of columns, depending on selected mode (must be > 0)
Method Detail

getLayoutAlignmentX

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

getLayoutAlignmentY

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

setLayoutAlignmentX

public void setLayoutAlignmentX(float ax)

setLayoutAlignmentY

public void setLayoutAlignmentY(float ay)

invalidateLayout

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

maximumLayoutSize

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

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
If mode is MODE_FIXED_COLUMNS, then the components are filled in row by row.
If mode is MODE_FIXED_ROWS, then the components are filled in column by column.

Specified by:
addLayoutComponent in interface LayoutManager2
See Also:
LayoutManager2.addLayoutComponent(java.awt.Component, java.lang.Object)

removeLayoutComponent

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

layoutContainer

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

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Adds a component with resize constraints StretchGridLayout.Constraint.STRETCH_BOTH

Specified by:
addLayoutComponent in interface LayoutManager
See Also:
LayoutManager.addLayoutComponent(java.lang.String, java.awt.Component)

minimumLayoutSize

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

preferredLayoutSize

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