Venice 0.7beta

org.mov.ui
Class GridBagHelper

java.lang.Object
  extended by org.mov.ui.GridBagHelper

public class GridBagHelper
extends java.lang.Object

GridBagHelper is a class that makes it easier to create form user interfaces. Using GridBagLayout and this class you can easily create forms, reducing code repeitition. For example to create a form which lets the user fill in two text field entries:

 JPanel formPanel = new JPanel();
 GridBagLayout gridbag = new GridBagLayout();
 GridBagConstraints c = new GridBagConstraints();
 formPanel.setLayout(gridbag);
           
 c.weightx = 1.0;
 c.ipadx = 5;
 c.anchor = GridBagConstraints.WEST;
          
 JTextField initialCapitalTextField = 
    GridBagHelper.addTextRow(formPanel, "Initial Capital", "", gridbag, c, 
                             10);
 JTextField tradeCostTextField =
    GridBagHelper.addTextRow(formPanel, "Trade Cost", "", gridbag, c, 5);

 


Method Summary
static javax.swing.JCheckBox addCheckBoxRow(javax.swing.JPanel panel, java.lang.String field, boolean isSelected, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Append a new row containing a check box button to the form.
static javax.swing.JComboBox addComboBox(javax.swing.JPanel panel, java.lang.String field, java.util.Vector list, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Append a new list combo box to the form.
static ExpressionComboBox addExpressionRow(javax.swing.JPanel panel, java.lang.String field, java.lang.String value, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Append a new row containing an expression combo box button to the form.
static javax.swing.JLabel addLabelRow(javax.swing.JPanel panel, java.lang.String field, java.lang.String labelText, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Append a new row containing a label field to the form.
static javax.swing.JPasswordField addPasswordRow(javax.swing.JPanel panel, java.lang.String field, java.lang.String value, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c, int length)
          Append a new row containing a password text field to the form.
static SymbolListComboBox addSymbolListComboBox(javax.swing.JPanel panel, java.lang.String field, java.lang.String symbolList, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Append a new symbol list combo box to the form.
static javax.swing.JTextField addTextRow(javax.swing.JPanel panel, java.lang.String field, java.lang.String value, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c, int length)
          Append a new row containing a text field to the form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addCheckBoxRow

public static javax.swing.JCheckBox addCheckBoxRow(javax.swing.JPanel panel,
                                                   java.lang.String field,
                                                   boolean isSelected,
                                                   java.awt.GridBagLayout gridbag,
                                                   java.awt.GridBagConstraints c)
Append a new row containing a check box button to the form.

Parameters:
panel - form panel
field - text to display next to check box
isSelected - is the check box currently selected?
gridbag - the form's gridbag
c - the form's constraints
Returns:
the check box

addExpressionRow

public static ExpressionComboBox addExpressionRow(javax.swing.JPanel panel,
                                                  java.lang.String field,
                                                  java.lang.String value,
                                                  java.awt.GridBagLayout gridbag,
                                                  java.awt.GridBagConstraints c)
Append a new row containing an expression combo box button to the form.

Parameters:
panel - form panel
field - text to display next to expression combo box
value - initial value of combo box
gridbag - the form's gridbag
c - the form's constraints
Returns:
the combo box

addPasswordRow

public static javax.swing.JPasswordField addPasswordRow(javax.swing.JPanel panel,
                                                        java.lang.String field,
                                                        java.lang.String value,
                                                        java.awt.GridBagLayout gridbag,
                                                        java.awt.GridBagConstraints c,
                                                        int length)
Append a new row containing a password text field to the form.

Parameters:
panel - form panel
field - text to display next to password text field
value - initial value of password text field
gridbag - the form's gridbag
c - the form's constraints
length - the length of the text field
Returns:
the password text field

addTextRow

public static javax.swing.JTextField addTextRow(javax.swing.JPanel panel,
                                                java.lang.String field,
                                                java.lang.String value,
                                                java.awt.GridBagLayout gridbag,
                                                java.awt.GridBagConstraints c,
                                                int length)
Append a new row containing a text field to the form.

Parameters:
panel - form panel
field - text to display next to text field
value - initial value of text field
gridbag - the form's gridbag
c - the form's constraints
length - the length of text field
Returns:
the text field

addLabelRow

public static javax.swing.JLabel addLabelRow(javax.swing.JPanel panel,
                                             java.lang.String field,
                                             java.lang.String labelText,
                                             java.awt.GridBagLayout gridbag,
                                             java.awt.GridBagConstraints c)
Append a new row containing a label field to the form.

Parameters:
panel - form panel
field - text to display next to the label field
labelText - label text
gridbag - the form's gridbag
c - the form's constraints
Returns:
the label field

addSymbolListComboBox

public static SymbolListComboBox addSymbolListComboBox(javax.swing.JPanel panel,
                                                       java.lang.String field,
                                                       java.lang.String symbolList,
                                                       java.awt.GridBagLayout gridbag,
                                                       java.awt.GridBagConstraints c)
Append a new symbol list combo box to the form.

Parameters:
panel - form panel
field - text to display next to the combo box
symbolList - initial symbol list
gridbag - the form's gridbag
c - the form's constraints
Returns:
the symbol list combo box

addComboBox

public static javax.swing.JComboBox addComboBox(javax.swing.JPanel panel,
                                                java.lang.String field,
                                                java.util.Vector list,
                                                java.awt.GridBagLayout gridbag,
                                                java.awt.GridBagConstraints c)
Append a new list combo box to the form.

Parameters:
panel - form panel
field - text to display next to the combo box
gridbag - the form's gridbag
c - the form's constraints
Returns:
the symbol list combo box

Venice 0.7beta