Back to index

wims  3.65+svn20090927
Static Public Member Functions | Static Private Member Functions
SharpTools.SharpOptionPane Class Reference

List of all members.

Static Public Member Functions

static Object showInputDialog (Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
static Integer showIntegerInputDialog (Component parentComponent, Object message, String title, int messageType, Icon icon, Object initialSelectionValue)
static void showMessageDialog (Component parentComponent, Object message)
static void showMessageDialog (Component parentComponent, Object message, String title, int messageType)
static void showMessageDialog (Component parentComponent, Object message, String title, int messageType, Icon icon)
static int showOptionDialog (Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
static int showOptionDialog (Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, int defaultIndex)
 Note the interface is different from JOptionPane.showOptionDialog()

Static Private Member Functions

static Object showInputDialog (Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue, boolean isInteger)
 This is used by showInputDialog and showIntegerInputDialog.

Detailed Description

Definition at line 21 of file SharpOptionPane.java.


Member Function Documentation

static Object SharpTools.SharpOptionPane.showInputDialog ( Component  parentComponent,
Object  message,
String  title,
int  messageType,
Icon  icon,
Object[]  selectionValues,
Object  initialSelectionValue 
) [inline, static]
Parameters:
parentComponentthe parent Component for the dialog
messagethe Object to display
titlethe String to display in the dialog title bar
messageTypethe type of message to be displayed
iconthe Icon image to display
selectionValuesan array of Objects that gives the possible selections
initialSelectionValuethe value used to initialize the input field
Returns:
the input object

Definition at line 33 of file SharpOptionPane.java.

                                                                  {
       return showInputDialog(parentComponent, message, title, messageType,
                            icon, selectionValues, initialSelectionValue,
                            false);
    }

Here is the caller graph for this function:

static Object SharpTools.SharpOptionPane.showInputDialog ( Component  parentComponent,
Object  message,
String  title,
int  messageType,
Icon  icon,
Object[]  selectionValues,
Object  initialSelectionValue,
boolean  isInteger 
) [inline, static, private]

This is used by showInputDialog and showIntegerInputDialog.

Parameters:
parentComponentthe parent Component for the dialog
messagethe Object to display
titlethe String to display in the dialog title bar
messageTypethe type of message to be displayed
iconthe Icon image to display
selectionValuesan array of Objects that gives the possible selections
initialSelectionValuethe value used to initialize the input field
isIntegerwhether we only allow integer input
Returns:
the input object

Definition at line 84 of file SharpOptionPane.java.

                                                        {
       JPanel panel = new JPanel(new BorderLayout());
       JComponent com;
       int choice;

       if (selectionValues == null) {
           // we use a JTextField
           if (isInteger) {
              com = new NumberField(true, true);
              ((JTextField)com).setText(initialSelectionValue.toString());
           }
           else
              com = new JTextField(initialSelectionValue.toString());

           ((JTextField)com).selectAll();
       }
       else {
           JComboBox box = new JComboBox(selectionValues);
           if (initialSelectionValue != null)
              box.setSelectedItem(initialSelectionValue);
           else
              box.setSelectedIndex(0);

           com = box;
       
       }

       if (message instanceof Component)
           panel.add((Component)message, BorderLayout.NORTH);
       else
           panel.add(new Label(message.toString()), BorderLayout.NORTH);
       
       panel.add(com, BorderLayout.CENTER);
       
       choice = showOptionDialog(parentComponent, panel, title,
                              JOptionPane.OK_CANCEL_OPTION,
                              messageType, icon);

       if (choice == JOptionPane.OK_OPTION) {
           if (com instanceof JTextField)
              return ((JTextField)com).getText();
           else
              return ((JComboBox)com).getSelectedItem();
       }
       else
           return null;
    }

Here is the call graph for this function:

static Integer SharpTools.SharpOptionPane.showIntegerInputDialog ( Component  parentComponent,
Object  message,
String  title,
int  messageType,
Icon  icon,
Object  initialSelectionValue 
) [inline, static]
Parameters:
parentComponentthe parent Component for the dialog
messagethe Object to display
titlethe String to display in the dialog title bar
messageTypethe type of message to be displayed
iconthe Icon image to display
initialSelectionValuethe value used to initialize the input field
Returns:
the input string

Definition at line 54 of file SharpOptionPane.java.

                                                                          {
       Object input = showInputDialog(parentComponent, message, title,messageType, icon, null,initialSelectionValue, true);
       try {
           if (input != null)
              return Integer.getInteger(input.toString());
       }
       catch (Exception e) {
           System.out.println("Error\n"+e);
       }
       return null;
    }

Here is the call graph for this function:

static void SharpTools.SharpOptionPane.showMessageDialog ( Component  parentComponent,
Object  message 
) [inline, static]
Parameters:
parentComponentthe parent component
messagethe message to be displayed

Definition at line 143 of file SharpOptionPane.java.

                                                    {
       showMessageDialog(parentComponent, message, null, 0, null);
    }

Here is the caller graph for this function:

static void SharpTools.SharpOptionPane.showMessageDialog ( Component  parentComponent,
Object  message,
String  title,
int  messageType 
) [inline, static]
Parameters:
parentComponentthe parent component
messagethe message to be displayed
titledialog title
messageTypethe message type
iconthe icon to display

Definition at line 155 of file SharpOptionPane.java.

                                                     {
       showMessageDialog(parentComponent, message, title, messageType, null);
    }

Here is the call graph for this function:

static void SharpTools.SharpOptionPane.showMessageDialog ( Component  parentComponent,
Object  message,
String  title,
int  messageType,
Icon  icon 
) [inline, static]
Parameters:
parentComponentthe parent component
messagethe message to be displayed
titledialog title
messageTypethe message type
iconthe icon to display

Definition at line 169 of file SharpOptionPane.java.

                                               { 
       showOptionDialog(parentComponent, message, title,
                      JOptionPane.DEFAULT_OPTION,
                      messageType, icon, 0);
    }      

Here is the call graph for this function:

static int SharpTools.SharpOptionPane.showOptionDialog ( Component  parentComponent,
Object  message,
String  title,
int  optionType,
int  messageType,
Icon  icon 
) [inline, static]
Parameters:
parentComponentthe parent component
messagethe message to be displayed
titledialog title
optionTypethe option type
messageTypethe message type
iconthe icon to display
Returns:
user choice

Definition at line 188 of file SharpOptionPane.java.

                                              {
       return showOptionDialog(parentComponent, message, title, optionType,
                            messageType, icon, 0);
    }

Here is the caller graph for this function:

static int SharpTools.SharpOptionPane.showOptionDialog ( Component  parentComponent,
Object  message,
String  title,
int  optionType,
int  messageType,
Icon  icon,
int  defaultIndex 
) [inline, static]

Note the interface is different from JOptionPane.showOptionDialog()

Parameters:
parentComponentthe parent component
messagethe message to be displayed
titledialog title
optionTypethe option type
messageTypethe message type
iconthe icon to display
defaultIndexdefaultIndex
Returns:
user choice

Definition at line 210 of file SharpOptionPane.java.

                                                     {

       SharpDialog dialog;

       if (parentComponent instanceof Frame)
           dialog = new SharpDialog((Frame)parentComponent, title, true);
       else
           dialog = new SharpDialog((Dialog)parentComponent, title, true);
           
       dialog.setOptionPane(message, messageType,
                          optionType, icon,
                          defaultIndex);
       
       dialog.show();
       return dialog.getChoice();
    }

Here is the call graph for this function:


The documentation for this class was generated from the following file: