edu.sdsc.inca
Class IncatComponents

java.lang.Object
  extended by edu.sdsc.inca.IncatComponents

public class IncatComponents
extends java.lang.Object

This class contains static convenience methods and constants used in the construction and display of Incat GUI components.


Constructor Summary
IncatComponents()
           
 
Method Summary
static void alignBoxHeights(javax.swing.Box[] boxes)
          Adds vertical struts to a set of Boxes to make them the same height.
static javax.swing.Box BoxFactory(javax.swing.JComponent[] components, boolean centered)
          Returns a Box that contains the specified components.
static javax.swing.JButton JButtonFactory(java.lang.String label, java.lang.String actionCommand, java.awt.event.ActionListener listener)
          Returns a JButton that will send the specified event to the specified listener when pressed.
static javax.swing.JMenuItem JMenuItemFactory(java.lang.String label, java.lang.String actionCommand, java.awt.event.ActionListener listener)
          Returns a JMenuItem that will send the specified event to the specified listener when selected.
static javax.swing.JMenuItem JMenuItemFactory(java.lang.String label, java.lang.String actionCommand, java.awt.event.ActionListener listener, char shortcut)
          Returns a JMenuItem that will send the specified event to the specified listener when selected or when a specified shortcut key combo is pressed.
static javax.swing.JPasswordField JPasswordFieldFactory(int width, java.lang.String actionCommand, java.awt.event.ActionListener listener)
          Returns a JPasswordField of the specified width that will send the specified event to the specified listener when text is entered.
static javax.swing.JTextField JTextFieldFactory(int width, java.lang.String actionCommand, java.awt.event.ActionListener listener)
          Returns a JTextField of the specified width that will send the specified event to the specified listener when text is entered.
static boolean setJComboBoxSelectedString(javax.swing.JComboBox box, java.lang.String s)
          Sets the selected element of the specified JComboBox to the element that matches the specified string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IncatComponents

public IncatComponents()
Method Detail

alignBoxHeights

public static void alignBoxHeights(javax.swing.Box[] boxes)
Adds vertical struts to a set of Boxes to make them the same height.

Parameters:
boxes - the boxes to align

BoxFactory

public static javax.swing.Box BoxFactory(javax.swing.JComponent[] components,
                                         boolean centered)
Returns a Box that contains the specified components.

Parameters:
components - components to place in the Box; null elements indicate the end of a row of components
centered - indicates whether or not the components should be centered
Returns:
a Box, configured as specified

JButtonFactory

public static javax.swing.JButton JButtonFactory(java.lang.String label,
                                                 java.lang.String actionCommand,
                                                 java.awt.event.ActionListener listener)
Returns a JButton that will send the specified event to the specified listener when pressed.

Parameters:
label - the label displayed on the button
actionCommand - command sent when the button is pressed, optional
listener - listener notified when button is pressed, optional
Returns:
a button, configured as specified

JMenuItemFactory

public static javax.swing.JMenuItem JMenuItemFactory(java.lang.String label,
                                                     java.lang.String actionCommand,
                                                     java.awt.event.ActionListener listener,
                                                     char shortcut)
Returns a JMenuItem that will send the specified event to the specified listener when selected or when a specified shortcut key combo is pressed.

Parameters:
label - the label displayed on the menu item
actionCommand - command sent when the menu item is selected
listener - listener notified when menu item is selected
shortcut - if non-blank, a keyboard shortcut character for the item
Returns:
a menu item, configured as specified

JMenuItemFactory

public static javax.swing.JMenuItem JMenuItemFactory(java.lang.String label,
                                                     java.lang.String actionCommand,
                                                     java.awt.event.ActionListener listener)
Returns a JMenuItem that will send the specified event to the specified listener when selected.

Parameters:
label - the label displayed on the menu item
actionCommand - command sent when the menu item is selected
listener - listener notified when menu item is selected
Returns:
a menu item, configured as specified

JPasswordFieldFactory

public static javax.swing.JPasswordField JPasswordFieldFactory(int width,
                                                               java.lang.String actionCommand,
                                                               java.awt.event.ActionListener listener)
Returns a JPasswordField of the specified width that will send the specified event to the specified listener when text is entered.

Parameters:
width - the number of characters in the password field
actionCommand - command sent when return is pressed, optional
listener - listener notified when return is pressed, optional
Returns:
a password field, configured as specified

JTextFieldFactory

public static javax.swing.JTextField JTextFieldFactory(int width,
                                                       java.lang.String actionCommand,
                                                       java.awt.event.ActionListener listener)
Returns a JTextField of the specified width that will send the specified event to the specified listener when text is entered.

Parameters:
width - the number of characters in the text field
actionCommand - command sent when return is pressed, optional
listener - listener notified when return is pressed, optional
Returns:
a text field, configured as specified

setJComboBoxSelectedString

public static boolean setJComboBoxSelectedString(javax.swing.JComboBox box,
                                                 java.lang.String s)
Sets the selected element of the specified JComboBox to the element that matches the specified string.

Parameters:
box - the box to set
s - the value to match
Returns:
true if the specified string was found, otherwise false