becker.gui
Class FormLayout

java.lang.Object
  extended by becker.gui.FormLayout
All Implemented Interfaces:
LayoutManager

public class FormLayout
extends Object
implements LayoutManager

A layout manager that arranges components in a double column. In most cases the left column will hold a label and the right column will hold a component the user can manipulate. Preferred component sizes are respected as much as possible. Components in the left column are right justified; components in the right column are left justified.

Author:
Byron Weber Becker

Constructor Summary
FormLayout()
          Construct a new FormLayout object.
FormLayout(int hGap, int vGap)
          Construct a new FormLayout object.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Adds the specified component with the specified name to the layout.
 void layoutContainer(Container parent)
          Lays out the container in the specified panel.
 Dimension minimumLayoutSize(Container parent)
          Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
 Dimension preferredLayoutSize(Container parent)
          Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
 void removeLayoutComponent(Component comp)
          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
 

Constructor Detail

FormLayout

public FormLayout()
Construct a new FormLayout object.


FormLayout

public FormLayout(int hGap,
                  int vGap)
Construct a new FormLayout object.

Parameters:
hGap - the number of hortizontal pixels between components
vGap - the number of vertical pixels between components
Method Detail

addLayoutComponent

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

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

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Removes the specified component from the layout.

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

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.

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

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.

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

layoutContainer

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

Specified by:
layoutContainer in interface LayoutManager
Parameters:
parent - the component which needs to be laid out