kirk.gui.layout
Class CenteredLineLayout

java.lang.Object
  |
  +--kirk.gui.layout.LineLayout
        |
        +--kirk.gui.layout.VariableLineLayout
              |
              +--kirk.gui.layout.CenteredLineLayout
All Implemented Interfaces:
LayoutManager

public class CenteredLineLayout
extends VariableLineLayout

CenteredLineLayout extends VariableLineLayout, and it makes each component as high and wide as its preferred size. It also centers all components horizontally. Use this class if you don't want to waste space or if you want easy adding of components under each other. This class is particularly useful for PopupDialogs. Actually, it was written for that purpose. This class is not a real LineLayout, since it manages the width of its components itself... but it uses all the other inherited stuff. It even has the same preferred and minimum size methods as VariableLineLayout.

Version:
1
Author:
Berend "Kirk" Wouda
See Also:
LineLayout, VariableLineLayout

Field Summary
 
Fields inherited from class kirk.gui.layout.LineLayout
 
Constructor Summary
CenteredLineLayout()
          Constructs a new CenteredLineLayout.
CenteredLineLayout(int verticalgap)
          Constructs a new CenteredLineLayout with the given value for the vertical gap, and the default value for the horizontal gap.
CenteredLineLayout(int horizontalgap, int verticalgap)
          Constructs a new CenteredLineLayout with the given values for the gaps.
 
Method Summary
 void layoutContainer(Container parent)
          Lays out the given Container.
 
Methods inherited from class kirk.gui.layout.VariableLineLayout
minimumLayoutSize, preferredLayoutSize
 
Methods inherited from class kirk.gui.layout.LineLayout
addLayoutComponent, getHorizontalGap, getMinimumWidth, getPreferredWidth, getVerticalGap, getWidth, removeLayoutComponent, setHorizontalGap, setVerticalGap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CenteredLineLayout

public CenteredLineLayout(int horizontalgap,
                          int verticalgap)
Constructs a new CenteredLineLayout with the given values for the gaps.


CenteredLineLayout

public CenteredLineLayout(int verticalgap)
Constructs a new CenteredLineLayout with the given value for the vertical gap, and the default value for the horizontal gap.


CenteredLineLayout

public CenteredLineLayout()
Constructs a new CenteredLineLayout. Use the default values for the gaps.

Method Detail

layoutContainer

public void layoutContainer(Container parent)
Lays out the given Container.

Specified by:
layoutContainer in interface LayoutManager
Overrides:
layoutContainer in class VariableLineLayout
Parameters:
parent - The Container to be layed out.
See Also:
LineLayout.layoutContainer(java.awt.Container), LayoutManager.layoutContainer(java.awt.Container)