Class ButtonLayout

java.lang.Object
   |
   +----ButtonLayout

public abstract class ButtonLayout
extends Object
Handles the layout of buttons at a specified height in the frame. This will put a button named "done" at the bottom right of the window and any number of buttons at the bottom left and top left, as spcified in addButton().

Author:
Peter Sagerson, petersag@wpi.edu

Variable Index

 o bottomButtons
The list of buttons on the left.
 o BUFFER
 o BUTTON_BUFFER
 o BUTTON_HEIGHT
 o BUTTON_WIDTH
 o done
The done button.
 o frame
The dimensions of the frame itself.
 o margin
The margin around the window.
 o nBottom
Number of buttons that have been added.
 o nTop
Number of buttons that have been added.
 o topButtons
The list of buttons on the left.

Constructor Index

 o ButtonLayout(int, int)
Creates buttons and initializes n and margin.

Method Index

 o addButton(String, Component)
Adds a button to the list (or adds the done button).
 o calcDimensions(Container)
Calculates frame and margin.
 o layoutButtons(Container, int)
Lays out the buttons in the frame.
 o removeButton(Component)

Variables

 o BUFFER
 protected static final int BUFFER
 o BUTTON_BUFFER
 protected static final int BUTTON_BUFFER
 o BUTTON_HEIGHT
 protected static final int BUTTON_HEIGHT
 o BUTTON_WIDTH
 protected static final int BUTTON_WIDTH
 o nTop
 int nTop
Number of buttons that have been added.

 o nBottom
 int nBottom
Number of buttons that have been added.

 o topButtons
 Component topButtons[]
The list of buttons on the left.

 o bottomButtons
 Component bottomButtons[]
The list of buttons on the left.

 o done
 Component done
The done button.

 o margin
 protected Insets margin
The margin around the window. Computed in calcDimensions().

 o frame
 protected Dimension frame
The dimensions of the frame itself.

Constructors

 o ButtonLayout
 ButtonLayout(int inTop,
              int inBottom)
Creates buttons and initializes n and margin.

Parameters:
numButtons - the number of buttons that will be added.

Methods

 o addButton
 public void addButton(String name,
                       Component c)
Adds a button to the list (or adds the done button). Buttons other than the done button should be added from left to right as you want them to appear. The done button is named "done". Other buttons are named "bottom" or "top", depending on where you want them to go.

 o removeButton
 public void removeButton(Component c)
 o calcDimensions
 protected void calcDimensions(Container parent)
Calculates frame and margin. Subclasses should override this method, but call this one at the beginning of the new one.

 o layoutButtons
 public void layoutButtons(Container parent,
                           int bottomHeight)
Lays out the buttons in the frame.