gcspy.vis.utils
Class Factory

java.lang.Object
  extended by gcspy.vis.utils.Factory

public class Factory
extends java.lang.Object

Factory for GUI components

Author:
Tony Printezis, Richard Jones

Constructor Summary
Factory()
           
 
Method Summary
static javax.swing.JPanel createBorderPanel()
          Create a new panel with a border layout
static javax.swing.JButton createButton(java.lang.String text)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, java.awt.event.ActionListener al)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, boolean enabled)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, boolean enabled, java.awt.event.ActionListener al)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, boolean enabled, boolean small, java.awt.event.ActionListener al)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, boolean enabled, boolean small, java.lang.String toolTipText, java.awt.event.ActionListener al)
          Create a JButton
static javax.swing.JButton createButton(java.lang.String text, boolean enabled, java.lang.String toolTipText, java.awt.event.ActionListener al)
          Create a JButton
static javax.swing.JCheckBox createCheckBox()
          Create a new labelled JCheckBox
static javax.swing.JCheckBox createCheckBox(boolean selected)
          Create a new labelled JCheckBox
static javax.swing.JCheckBox createCheckBox(java.lang.String text)
          Create a new labelled JCheckBox
static javax.swing.JCheckBox createCheckBox(java.lang.String text, boolean selected)
          Create a new labelled JCheckBox
static javax.swing.JCheckBox createCheckBox(java.lang.String text, boolean selected, java.awt.event.ActionListener al)
          Create a new labelled JCheckBox
static javax.swing.JCheckBox createCheckBox(java.lang.String text, boolean enabled, boolean selected, java.awt.event.ActionListener al)
          Create a new labelled JCheckBox
static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text)
          Create a new JCheckBoxMenuItem
static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text, boolean state)
          Create a new JCheckBoxMenuItem
static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text, boolean state, java.awt.event.ActionListener al)
          Create a new JCheckBoxMenuItem
static javax.swing.JComboBox createComboBox()
          Create a new combo box
static javax.swing.JComboBox createComboBox(java.awt.event.ActionListener al)
          Create a new combo box
static javax.swing.JPanel createEmptyPanel(int border)
          Create an empty panel with a border
static javax.swing.JPanel createEmptyPanel(int border, java.awt.Component comp)
          Place a component in a new panel with a border
static javax.swing.JPanel createEmptyPanel(int width, int height)
          Create an empty panel
static javax.swing.JPanel createFlowPanel(int align)
          Create a new panel with a flow layout
static javax.swing.JPanel createGridPanel(int rows, int columns)
          Create a new panel with a title, using grid layout
static javax.swing.JPanel createGridPanel(int rows, int columns, java.lang.String title)
          Create a new panel with a title, using grid layout
static javax.swing.JButton createIconButton(javax.swing.Icon icon)
          Create a JButton with an icon
static javax.swing.JButton createIconButton(javax.swing.Icon icon, boolean enable, java.awt.event.ActionListener al)
          Create a JButton with an icon
static javax.swing.JButton createIconButton(javax.swing.Icon icon, boolean enable, java.lang.String toolTipText, java.awt.event.ActionListener al)
          Create a JButton with an icon
static javax.swing.JLabel createLabel(java.lang.String text)
          Create a JLabel
static javax.swing.JLabel createLabel(java.lang.String text, boolean enabled)
          Create a JLabel
static javax.swing.JLabel createLabel(java.lang.String text, int alignment)
          Create a JLabel
static javax.swing.JLabel createLabel(java.lang.String text, int alignment, boolean bold)
          Create a JLabel
static javax.swing.JMenu createMenu(java.lang.String title)
          Create a new JMenu
static javax.swing.JMenuItem createMenuItem(java.lang.String text)
          Create a new JMenuItem
static javax.swing.JMenuItem createMenuItem(java.lang.String text, java.awt.event.ActionListener al)
          Create a new JMenuItem
static javax.swing.JMenuItem createMenuItem(java.lang.String text, boolean enable, java.awt.event.ActionListener al)
          Create a new JMenuItem
static javax.swing.border.TitledBorder createPlainBorder()
          Create a new plain border
static javax.swing.JTable createTable(javax.swing.table.TableModel model)
          Create a new table
static javax.swing.JTable createTable(javax.swing.table.TableModel model, boolean resizable, boolean auto)
          Create a new table
static javax.swing.JTextArea createTextArea(int rows, int columns, boolean editable)
          Text Areas ****
static javax.swing.JTextArea createTextArea(int rows, int columns, boolean editable, boolean monospaced)
          Create a new text area
static javax.swing.JTextField createTextField(int columns, boolean editable)
          Create a new text field
static javax.swing.JTextField createTextField(java.lang.String text, int columns, boolean editable)
          Create a new text field
static javax.swing.border.TitledBorder createTitledBorder(java.lang.String title)
          Create a new titled border
static javax.swing.JPanel createTitlePanel(java.lang.String title)
          Create a new panel with a title
static javax.swing.JPanel createTitlePanel(java.lang.String title, java.awt.Component comp)
          Place a component in a panel with a title
static void deselectCheckBox(javax.swing.JCheckBox checkBox)
          Make a check box unselected
static void disableButton(javax.swing.JButton button)
          Disable a JButton
static void disableCheckBox(javax.swing.JCheckBox checkBox)
          Disable a check box
static void disableComboBox(javax.swing.JComboBox comboBox)
          Disable a combo box
static void disableLabel(javax.swing.JLabel label)
          Disable a JLabel
static void disableMenuItem(javax.swing.JMenuItem menuItem)
          Disable a JMenuItem
static void disableTextArea(javax.swing.JTextArea area)
          Disable a text area
static void disableTextField(javax.swing.JTextField textField)
          Disable a text field
static void enableButton(javax.swing.JButton button)
          Enable a JButton
static void enableCheckBox(javax.swing.JCheckBox checkBox)
          Enable a check box
static void enableComboBox(javax.swing.JComboBox comboBox)
          Enable a combo box
static void enableLabel(javax.swing.JLabel label)
          Enable a JLabel
static void enableMenuItem(javax.swing.JMenuItem menuItem)
          Enable a JMenuItem
static void enableTextArea(javax.swing.JTextArea area)
          Enable a text area
static void enableTextField(javax.swing.JTextField textField)
          Enable a text field
static void selectCheckBox(javax.swing.JCheckBox checkBox)
          Make a check box selected
static void setColumnWidth(javax.swing.JTable table, int col, int width)
          Set the width of a column of a table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

public Factory()
Method Detail

createButton

public static javax.swing.JButton createButton(java.lang.String text)
Create a JButton

Parameters:
text - The label to use
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               java.awt.event.ActionListener al)
Create a JButton

Parameters:
text - The label to use
al - An ActionListener for the button
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean enabled)
Create a JButton

Parameters:
text - The label to use
enabled - Is the button enabled?
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean enabled,
                                               java.awt.event.ActionListener al)
Create a JButton

Parameters:
text - The label to use
enabled - Is the button enabled?
al - An ActionListener for the button
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean enabled,
                                               boolean small,
                                               java.awt.event.ActionListener al)
Create a JButton

Parameters:
text - The label to use
enabled - Is the button enabled?
small - Is the button's font size small?
al - An ActionListener for the button
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean enabled,
                                               java.lang.String toolTipText,
                                               java.awt.event.ActionListener al)
Create a JButton

Parameters:
text - The label to use
enabled - Is the button enabled?
toolTipText - tool-tip text for the button
al - An ActionListener for the button
Returns:
a new JButton

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean enabled,
                                               boolean small,
                                               java.lang.String toolTipText,
                                               java.awt.event.ActionListener al)
Create a JButton

Parameters:
text - The label to use
enabled - Is the button enabled?
small - Is the button's font size small?
toolTipText - tool-tip text for the button
al - An ActionListener for the button
Returns:
a new JButton

enableButton

public static void enableButton(javax.swing.JButton button)
Enable a JButton

Parameters:
button - the button

disableButton

public static void disableButton(javax.swing.JButton button)
Disable a JButton

Parameters:
button - the button

createIconButton

public static javax.swing.JButton createIconButton(javax.swing.Icon icon)
Create a JButton with an icon

Parameters:
icon - The icon
Returns:
a new JButton

createIconButton

public static javax.swing.JButton createIconButton(javax.swing.Icon icon,
                                                   boolean enable,
                                                   java.awt.event.ActionListener al)
Create a JButton with an icon

Parameters:
icon - The icon
enable - Is the button enabled?
al - ActionListener for the button
Returns:
a new JButton

createIconButton

public static javax.swing.JButton createIconButton(javax.swing.Icon icon,
                                                   boolean enable,
                                                   java.lang.String toolTipText,
                                                   java.awt.event.ActionListener al)
Create a JButton with an icon

Parameters:
icon - The icon
enable - Is the button enabled?
toolTipText - Tool-tip text for the button
al - ActionListener for the button
Returns:
a new JButton

createCheckBoxMenuItem

public static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text)
Create a new JCheckBoxMenuItem

Parameters:
text - The text for the menu item
Returns:
a new JCheckBoxMenuItem

createCheckBoxMenuItem

public static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text,
                                                                   boolean state)
Create a new JCheckBoxMenuItem

Parameters:
text - The text for the menu item
state - The state of the check-box
Returns:
a new JCheckBoxMenuItem

createCheckBoxMenuItem

public static javax.swing.JCheckBoxMenuItem createCheckBoxMenuItem(java.lang.String text,
                                                                   boolean state,
                                                                   java.awt.event.ActionListener al)
Create a new JCheckBoxMenuItem

Parameters:
text - The text for the menu item
state - The state of the check-box
al - An ActionListener for the item
Returns:
a new JCheckBoxMenuItem

createCheckBox

public static javax.swing.JCheckBox createCheckBox()
Create a new labelled JCheckBox

Returns:
return a new JCheckBox

createCheckBox

public static javax.swing.JCheckBox createCheckBox(boolean selected)
Create a new labelled JCheckBox

Parameters:
selected - Is the box selected?
Returns:
return a new JCheckBox

createCheckBox

public static javax.swing.JCheckBox createCheckBox(java.lang.String text)
Create a new labelled JCheckBox

Parameters:
text - The text to label the check-box
Returns:
return a new JCheckBox

createCheckBox

public static javax.swing.JCheckBox createCheckBox(java.lang.String text,
                                                   boolean selected)
Create a new labelled JCheckBox

Parameters:
text - The text to label the check-box
selected - Is the box selected?
Returns:
return a new JCheckBox

createCheckBox

public static javax.swing.JCheckBox createCheckBox(java.lang.String text,
                                                   boolean selected,
                                                   java.awt.event.ActionListener al)
Create a new labelled JCheckBox

Parameters:
text - The text to label the check-box
selected - Is the box selected?
al - An ActionListener for the check-box
Returns:
return a new JCheckBox

createCheckBox

public static javax.swing.JCheckBox createCheckBox(java.lang.String text,
                                                   boolean enabled,
                                                   boolean selected,
                                                   java.awt.event.ActionListener al)
Create a new labelled JCheckBox

Parameters:
text - The text to label the check-box
enabled - Is the check-box enabled?
selected - Is the box selected?
al - An ActionListener for the check-box
Returns:
return a new JCheckBox

selectCheckBox

public static void selectCheckBox(javax.swing.JCheckBox checkBox)
Make a check box selected

Parameters:
checkBox - The check box

deselectCheckBox

public static void deselectCheckBox(javax.swing.JCheckBox checkBox)
Make a check box unselected

Parameters:
checkBox - The check box

enableCheckBox

public static void enableCheckBox(javax.swing.JCheckBox checkBox)
Enable a check box

Parameters:
checkBox - The check box

disableCheckBox

public static void disableCheckBox(javax.swing.JCheckBox checkBox)
Disable a check box

Parameters:
checkBox - The check box

createComboBox

public static javax.swing.JComboBox createComboBox()
Create a new combo box

Returns:
the combo box

createComboBox

public static javax.swing.JComboBox createComboBox(java.awt.event.ActionListener al)
Create a new combo box

Parameters:
al - An ActionListener
Returns:
the combo box

enableComboBox

public static void enableComboBox(javax.swing.JComboBox comboBox)
Enable a combo box

Parameters:
comboBox - the combo box

disableComboBox

public static void disableComboBox(javax.swing.JComboBox comboBox)
Disable a combo box

Parameters:
comboBox - the combo box

createLabel

public static javax.swing.JLabel createLabel(java.lang.String text,
                                             int alignment)
Create a JLabel

Parameters:
text - Text for the label
alignment - Horizontal alignment
Returns:
a new JLabel

createLabel

public static javax.swing.JLabel createLabel(java.lang.String text,
                                             int alignment,
                                             boolean bold)
Create a JLabel

Parameters:
text - Text for the label
alignment - Horizontal alignment
bold - Should the font be bold?
Returns:
a new JLabel

createLabel

public static javax.swing.JLabel createLabel(java.lang.String text)
Create a JLabel

Parameters:
text - Text for the label
Returns:
a new JLabel

createLabel

public static javax.swing.JLabel createLabel(java.lang.String text,
                                             boolean enabled)
Create a JLabel

Parameters:
text - Text for the label
enabled - True if the label is enabled
Returns:
a new JLabel

enableLabel

public static void enableLabel(javax.swing.JLabel label)
Enable a JLabel

Parameters:
label - the JLabel

disableLabel

public static void disableLabel(javax.swing.JLabel label)
Disable a JLabel

Parameters:
label - the JLabel

createMenu

public static javax.swing.JMenu createMenu(java.lang.String title)
Create a new JMenu

Parameters:
title - The text for the menu
Returns:
The new JMenu

createMenuItem

public static javax.swing.JMenuItem createMenuItem(java.lang.String text)
Create a new JMenuItem

Parameters:
text - The text for the menu item
Returns:
The new JMenuItem

createMenuItem

public static javax.swing.JMenuItem createMenuItem(java.lang.String text,
                                                   java.awt.event.ActionListener al)
Create a new JMenuItem

Parameters:
text - The text for the menu item
al - An ActionListener for the item
Returns:
The new JMenuItem

createMenuItem

public static javax.swing.JMenuItem createMenuItem(java.lang.String text,
                                                   boolean enable,
                                                   java.awt.event.ActionListener al)
Create a new JMenuItem

Parameters:
text - The text for the menu item
enable - Is the item enabled?
al - An ActionListener for the item
Returns:
The new JMenuItem

enableMenuItem

public static void enableMenuItem(javax.swing.JMenuItem menuItem)
Enable a JMenuItem

Parameters:
menuItem - the JMenuItem

disableMenuItem

public static void disableMenuItem(javax.swing.JMenuItem menuItem)
Disable a JMenuItem

Parameters:
menuItem - the JMenuItem

createEmptyPanel

public static javax.swing.JPanel createEmptyPanel(int width,
                                                  int height)
Create an empty panel

Parameters:
width - The width of the panel
height - The height of the panel [Why not use a box Box? ]

createEmptyPanel

public static javax.swing.JPanel createEmptyPanel(int border)
Create an empty panel with a border

Parameters:
border - the width of the border
Returns:
the panel

createEmptyPanel

public static javax.swing.JPanel createEmptyPanel(int border,
                                                  java.awt.Component comp)
Place a component in a new panel with a border

Parameters:
border - the width of the border
comp - the component
Returns:
the panel

createTitlePanel

public static javax.swing.JPanel createTitlePanel(java.lang.String title)
Create a new panel with a title

Parameters:
title - the title
Returns:
the new panel

createTitlePanel

public static javax.swing.JPanel createTitlePanel(java.lang.String title,
                                                  java.awt.Component comp)
Place a component in a panel with a title

Parameters:
title - The title
comp - The component
Returns:
the new panel

createBorderPanel

public static javax.swing.JPanel createBorderPanel()
Create a new panel with a border layout

Returns:
a new panel with a border layout

createFlowPanel

public static javax.swing.JPanel createFlowPanel(int align)
Create a new panel with a flow layout

Parameters:
align - The alignment
Returns:
the new panel

createGridPanel

public static javax.swing.JPanel createGridPanel(int rows,
                                                 int columns)
Create a new panel with a title, using grid layout

Parameters:
rows - The number of rows
columns - The number of columns
Returns:
the new panel

createGridPanel

public static javax.swing.JPanel createGridPanel(int rows,
                                                 int columns,
                                                 java.lang.String title)
Create a new panel with a title, using grid layout

Parameters:
rows - The number of rows
columns - The number of columns
title - the title of the panel
Returns:
the new panel

createTable

public static javax.swing.JTable createTable(javax.swing.table.TableModel model)
Create a new table

Parameters:
model - The table's model
Returns:
the new table

createTable

public static javax.swing.JTable createTable(javax.swing.table.TableModel model,
                                             boolean resizable,
                                             boolean auto)
Create a new table

Parameters:
model - The table's model
resizable - Treu if the user can resize/reorder columns?
auto - True if columns are automatically created from the model
Returns:
the new table

setColumnWidth

public static void setColumnWidth(javax.swing.JTable table,
                                  int col,
                                  int width)
Set the width of a column of a table

Parameters:
table - The table
col - The column number
width - The new width

createTextArea

public static javax.swing.JTextArea createTextArea(int rows,
                                                   int columns,
                                                   boolean editable)
Text Areas ****


createTextArea

public static javax.swing.JTextArea createTextArea(int rows,
                                                   int columns,
                                                   boolean editable,
                                                   boolean monospaced)
Create a new text area

Parameters:
rows - The number of rows
columns - The number of columns
editable - True if the text area is editable
monospaced - True if the font is monospaced
Returns:
a new text area

enableTextArea

public static void enableTextArea(javax.swing.JTextArea area)
Enable a text area

Parameters:
area - The test area

disableTextArea

public static void disableTextArea(javax.swing.JTextArea area)
Disable a text area

Parameters:
area - The test area

createTextField

public static javax.swing.JTextField createTextField(int columns,
                                                     boolean editable)
Create a new text field

Parameters:
columns - The columns in the field
editable - True if the field is editable
Returns:
a new text field

createTextField

public static javax.swing.JTextField createTextField(java.lang.String text,
                                                     int columns,
                                                     boolean editable)
Create a new text field

Parameters:
text - The text to place in the field
columns - The columns in the field
editable - True if the field is editable
Returns:
a new text field

enableTextField

public static void enableTextField(javax.swing.JTextField textField)
Enable a text field

Parameters:
textField - The test field

disableTextField

public static void disableTextField(javax.swing.JTextField textField)
Disable a text field

Parameters:
textField - The test field

createPlainBorder

public static javax.swing.border.TitledBorder createPlainBorder()
Create a new plain border

Returns:
a new plain area

createTitledBorder

public static javax.swing.border.TitledBorder createTitledBorder(java.lang.String title)
Create a new titled border

Parameters:
title - The title to use
Returns:
a new titled area