javax.swing.colorchooser
Class SmartGridLayout

java.lang.Object
  extended byjavax.swing.colorchooser.SmartGridLayout
All Implemented Interfaces:
LayoutManager, Serializable

class SmartGridLayout
extends Object
implements LayoutManager, Serializable

A better GridLayout class

Author:
Steve Wilson

Field Summary
(package private)  int columns
           
(package private)  int componentCount
           
(package private)  Component[][] layoutGrid
           
(package private)  int rows
           
(package private)  int xGap
           
(package private)  int yGap
           
 
Constructor Summary
SmartGridLayout(int numColumns, int numRows)
           
 
Method Summary
 void addLayoutComponent(String s, Component c)
          If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.
private  void buildLayoutGrid(Container c)
           
private  int computeColumnWidth(int columnNum)
           
private  int computeRowHeight(int rowNum)
           
 void layoutContainer(Container c)
          Lays out the specified container.
 Dimension minimumLayoutSize(Container c)
          Calculates the minimum size dimensions for the specified container, given the components it contains.
 Dimension preferredLayoutSize(Container c)
          Calculates the preferred size dimensions for the specified container, given the components it contains.
 void removeLayoutComponent(Component c)
          Removes the specified component from the layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rows

int rows

columns

int columns

xGap

int xGap

yGap

int yGap

componentCount

int componentCount

layoutGrid

Component[][] layoutGrid
Constructor Detail

SmartGridLayout

public SmartGridLayout(int numColumns,
                       int numRows)
Method Detail

layoutContainer

public void layoutContainer(Container c)
Description copied from interface: LayoutManager
Lays out the specified container.

Specified by:
layoutContainer in interface LayoutManager
Parameters:
c - the container to be laid out

minimumLayoutSize

public Dimension minimumLayoutSize(Container c)
Description copied from interface: LayoutManager
Calculates the minimum size dimensions for the specified container, given the components it contains.

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

preferredLayoutSize

public Dimension preferredLayoutSize(Container c)
Description copied from interface: LayoutManager
Calculates the preferred size dimensions for the specified container, given the components it contains.

Specified by:
preferredLayoutSize in interface LayoutManager
Parameters:
c - the container to be laid out
See Also:
LayoutManager.minimumLayoutSize(java.awt.Container)

addLayoutComponent

public void addLayoutComponent(String s,
                               Component c)
Description copied from interface: LayoutManager
If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
s - the string to be associated with the component
c - the component to be added

removeLayoutComponent

public void removeLayoutComponent(Component c)
Description copied from interface: LayoutManager
Removes the specified component from the layout.

Specified by:
removeLayoutComponent in interface LayoutManager
Parameters:
c - the component to be removed

buildLayoutGrid

private void buildLayoutGrid(Container c)

computeColumnWidth

private int computeColumnWidth(int columnNum)

computeRowHeight

private int computeRowHeight(int rowNum)