com.equitysoft.cellspark
Class ProportionalLayout

java.lang.Object
  |
  +--com.equitysoft.cellspark.ProportionalLayout
All Implemented Interfaces:
java.awt.LayoutManager

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

A horizontal layout layout manager that allocates horizontal space in specified proportions. The same can be done with GridBagLayout but GridBagLayout has a problem when space is resized particularly when moving a JSplitPane divider - the proportions will suddenly change for no apparent reason. ProportionalLayout solves the problem. Revision date 12th July 2001

Author:
Colin Mummery e-mail: colin_mummery@yahoo.com Homepage:www.kagi.com/equitysoft

Constructor Summary
ProportionalLayout(int[] proportions)
          Constructs a ProportinalLayout instance with the specified horizontal component proportions
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Not used by this class
 void layoutContainer(java.awt.Container parent)
          Lays out the container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
          Not used by this class
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProportionalLayout

public ProportionalLayout(int[] proportions)
Constructs a ProportinalLayout instance with the specified horizontal component proportions
Parameters:
proportions - An int array of values indicating horizontal proportions. An array of 2,1,1 would give the first component added half the space horizontally, the second and the third would each get a quarter. More components would not be given any space at all. When there are less than the expected number of components the unused values in the proportions array will correspond to blank space in the layout.
Method Detail

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the container.
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

addLayoutComponent

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

removeLayoutComponent

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object