orc.spy
Class WeightedGridLayout

java.lang.Object
  extended by orc.spy.WeightedGridLayout
All Implemented Interfaces:
java.awt.LayoutManager

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

A layout manager similar to GridLayout, except that the cells are not constrained to be the same size. Instead, cells are initially made as small as possible (based on the components' minimum size). Then, any remaining space is distributed amongst the rows and columns according to user-specified weights. The resulting display forms a grid where each column has the same width and each row has the same height. The number of rows does not need to be explicitly specified: it will be computed automatically based on the number of components in the container and the number of columns. Written by Edwin Olson (ebolson@umich.edu), August 2008.


Constructor Summary
WeightedGridLayout(double[] columnWeights)
           
WeightedGridLayout(double[] columnWeights, int hgap, int vgap)
           
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
           
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
           
 void setDefaultRowWeight(double v)
           
 void setRowWeight(int row, double v)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedGridLayout

public WeightedGridLayout(double[] columnWeights,
                          int hgap,
                          int vgap)
Parameters:
columnWeights - Horizontal spacing "weight" per column
hgap - Pixel spcacing betweens columns
vgap - Pixel spacing between rows

WeightedGridLayout

public WeightedGridLayout(double[] columnWeights)
Method Detail

setDefaultRowWeight

public void setDefaultRowWeight(double v)

setRowWeight

public void setRowWeight(int row,
                         double v)

addLayoutComponent

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

layoutContainer

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

minimumLayoutSize

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

preferredLayoutSize

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

removeLayoutComponent

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