sophware.awt
Class RowColumnLayout

java.lang.Object
  extended bysophware.awt.RowColumnLayout
All Implemented Interfaces:
java.awt.LayoutManager

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

RowColumnLayout is a layout manager for a container that lays its components in rows and columns. Unlike the GridLayout, RowColumnLayout forces only components in the same row to be the same height and only components in the same column to be the same width. Optionally it can force ALL rows or ALL columns to be a uniformed height or width, similar to GridLayout.

Version:
1.0, 06 Feb 01
Author:
Russell Soph

Constructor Summary
RowColumnLayout(int rows, int cols)
          Creates a row column layout with the specified rows and columns.
RowColumnLayout(int rows, int cols, int hgap, int vgap)
          Creates a row column layout with the specified rows and columns.
RowColumnLayout(int rows, int cols, int hgap, int vgap, boolean cr, boolean cc)
          Creates a row column layout with the specified rows, columns, horizontal gap, and vertical gap.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component with the specified name to the layout.
 void layoutContainer(java.awt.Container parent)
          Lays out the container in the specified panel.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Returns the minimum dimensions needed to layout the components contained in the specified panel.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Returns the preferred dimensions for this layout given the components int the specified panel.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 java.lang.String toString()
          Returns the String representation of this RowColumnLayout's values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowColumnLayout

public RowColumnLayout(int rows,
                       int cols)
Creates a row column layout with the specified rows and columns.

Parameters:
rows - the rows
cols - the columns

RowColumnLayout

public RowColumnLayout(int rows,
                       int cols,
                       int hgap,
                       int vgap)
Creates a row column layout with the specified rows and columns.

Parameters:
rows - the rows
cols - the columns
hgap - the horizontal gap variable
vgap - the vertical gap variable

RowColumnLayout

public RowColumnLayout(int rows,
                       int cols,
                       int hgap,
                       int vgap,
                       boolean cr,
                       boolean cc)
Creates a row column layout with the specified rows, columns, horizontal gap, and vertical gap.

Parameters:
rows - the rows; zero means 'any number.'
cols - the columns; zero means 'any number.' Only one of 'rows' and 'cols' can be zero, not both.
hgap - the horizontal gap variable
vgap - the vertical gap variable
cr - conform all rows to one size
cc - conform all columns to one size
Throws:
java.lang.IllegalArgumentException - If the rows and columns are invalid.
Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds the specified component with the specified name to the layout.

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

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. Does not apply.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - the component to be removed

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Returns the preferred dimensions for this layout given the components int the specified panel.

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

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Returns the minimum dimensions needed to layout the components contained in the specified panel.

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

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the container in the specified panel.

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

toString

public java.lang.String toString()
Returns the String representation of this RowColumnLayout's values.