com.ibm.dse.tools.workbench.gui
Class JOptionPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JOptionPane
                          |
                          +--com.ibm.dse.tools.workbench.gui.JOptionPanel

public class JOptionPanel
extends javax.swing.JOptionPane

This class fixes the problem that a JOptionPane have when is showed from a dialog or a component in a dialog.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JOptionPane
javax.swing.JOptionPane.AccessibleJOptionPane
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.JOptionPane
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, icon, ICON_PROPERTY, INFORMATION_MESSAGE, INITIAL_SELECTION_VALUE_PROPERTY, INITIAL_VALUE_PROPERTY, initialSelectionValue, initialValue, INPUT_VALUE_PROPERTY, inputValue, message, MESSAGE_PROPERTY, MESSAGE_TYPE_PROPERTY, messageType, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, OPTION_TYPE_PROPERTY, options, OPTIONS_PROPERTY, optionType, PLAIN_MESSAGE, QUESTION_MESSAGE, SELECTION_VALUES_PROPERTY, selectionValues, UNINITIALIZED_VALUE, value, VALUE_PROPERTY, WANTS_INPUT_PROPERTY, wantsInput, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
JOptionPanel()
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message)
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message, int messageType)
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message, int messageType, int optionType)
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon)
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon, java.lang.Object[] options)
          JOptionPanel constructor comment.
JOptionPanel(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue)
          JOptionPanel constructor comment.
 
Method Summary
 javax.swing.JDialog createDialog(java.awt.Component parentComponent, java.lang.String title)
          Creates and returns a new JDialog wrapping this centered on the parentComponent in the parentComponent's frame.
static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message)
          Brings up a modal dialog with the options Yes, No and Cancel; with the title, "Select an Option".
static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType)
          Brings up a modal dialog where the number of choices is determined by the optionType parameter.
static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType)
          Brings up a modal dialog where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display.
static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon)
          Brings up a modal dialog with a specified icon, where the number of choices is determined by the optionType parameter.
static java.lang.Object showInputDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon, java.lang.Object[] selectionValues, java.lang.Object initialSelectionValue)
          Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified.
static void showMessageDialog(java.awt.Component parentComponent, java.lang.Object message)
          Brings up a confirmation dialog -- a modal information-message dialog titled "Confirm".
static void showMessageDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType)
          Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
static void showMessageDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon)
          Brings up a dialog displaying a message, specifying all parameters.
static int showOptionDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue)
          Brings up a modal dialog with a specified icon, where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter.
 
Methods inherited from class javax.swing.JOptionPane
createInternalFrame, getAccessibleContext, getDesktopPaneForComponent, getFrameForComponent, getIcon, getInitialSelectionValue, getInitialValue, getInputValue, getMaxCharactersPerLineCount, getMessage, getMessageType, getOptions, getOptionType, getRootFrame, getSelectionValues, getUI, getUIClassID, getValue, getWantsInput, paramString, selectInitialValue, setIcon, setInitialSelectionValue, setInitialValue, setInputValue, setMessage, setMessageType, setOptions, setOptionType, setRootFrame, setSelectionValues, setUI, setValue, setWantsInput, showInputDialog, showInputDialog, showInputDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalInputDialog, showInternalInputDialog, showInternalInputDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalOptionDialog, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JOptionPanel

public JOptionPanel()
JOptionPanel constructor comment.

JOptionPanel

public JOptionPanel(java.lang.Object message)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object

JOptionPanel

public JOptionPanel(java.lang.Object message,
                    int messageType)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object
messageType - int

JOptionPanel

public JOptionPanel(java.lang.Object message,
                    int messageType,
                    int optionType)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object
messageType - int
optionType - int

JOptionPanel

public JOptionPanel(java.lang.Object message,
                    int messageType,
                    int optionType,
                    javax.swing.Icon icon)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object
messageType - int
optionType - int
icon - javax.swing.Icon

JOptionPanel

public JOptionPanel(java.lang.Object message,
                    int messageType,
                    int optionType,
                    javax.swing.Icon icon,
                    java.lang.Object[] options)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object
messageType - int
optionType - int
icon - javax.swing.Icon
options - java.lang.Object[]

JOptionPanel

public JOptionPanel(java.lang.Object message,
                    int messageType,
                    int optionType,
                    javax.swing.Icon icon,
                    java.lang.Object[] options,
                    java.lang.Object initialValue)
JOptionPanel constructor comment.
Parameters:
message - java.lang.Object
messageType - int
optionType - int
icon - javax.swing.Icon
options - java.lang.Object[]
initialValue - java.lang.Object
Method Detail

createDialog

public javax.swing.JDialog createDialog(java.awt.Component parentComponent,
                                        java.lang.String title)
Creates and returns a new JDialog wrapping this centered on the parentComponent in the parentComponent's frame. title is the title of the returned dialog. The returned JDialog will be set up such that once it is closed, or the user clicks on the OK button, the dialog will be disposed and closed.
Overrides:
createDialog in class javax.swing.JOptionPane
Parameters:
title - the title string for the dialog
Returns:
a new JDialog containing this instance

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message)
Brings up a modal dialog with the options Yes, No and Cancel; with the title, "Select an Option".
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
Returns:
an int indicating the option selected by the user

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message,
                                    java.lang.String title,
                                    int optionType)
Brings up a modal dialog where the number of choices is determined by the optionType parameter.
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
Returns:
an int indicating the option selected by the user

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message,
                                    java.lang.String title,
                                    int optionType,
                                    int messageType)
Brings up a modal dialog where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display. The messageType parameter is primarily used to supply a default icon from the look and feel.
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an int designating the kind of message this is, primarily used to determine the icon from the pluggable look and feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
Returns:
an int indicating the option selected by the user

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message,
                                    java.lang.String title,
                                    int optionType,
                                    int messageType,
                                    javax.swing.Icon icon)
Brings up a modal dialog with a specified icon, where the number of choices is determined by the optionType parameter. The messageType parameter is primarily used to supply a default icon from the look and feel.
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an int designating the kind of message this is, primarily used to determine the icon from the pluggable look and feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
icon - the icon to display in the dialog
Returns:
an int indicating the option selected by the user

showInputDialog

public static java.lang.Object showInputDialog(java.awt.Component parentComponent,
                                               java.lang.Object message,
                                               java.lang.String title,
                                               int messageType,
                                               javax.swing.Icon icon,
                                               java.lang.Object[] selectionValues,
                                               java.lang.Object initialSelectionValue)
Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified. The user will able to choose from selectionValues, where null implies the user can input whatever they wish, usually by means of a JTextField. initialSelectionValue is the initial value to prompt the user with. It is up to the UI to decide how best to represent the selectionValues, but usually a JComboBox, JList, or JTextField will be used.
Parameters:
parentComponent - the parent Component for the dialog
message - the Object to display
title - the String to display in the dialog title bar
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
icon - the Icon image to display
selectionValues - an array of Objects that gives the possible selections
initialSelectionValue - the value used to initialize the input field
Returns:
users input, or null meaning the user canceled the input

showMessageDialog

public static void showMessageDialog(java.awt.Component parentComponent,
                                     java.lang.Object message)
Brings up a confirmation dialog -- a modal information-message dialog titled "Confirm".
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display

showMessageDialog

public static void showMessageDialog(java.awt.Component parentComponent,
                                     java.lang.Object message,
                                     java.lang.String title,
                                     int messageType)
Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.

showMessageDialog

public static void showMessageDialog(java.awt.Component parentComponent,
                                     java.lang.Object message,
                                     java.lang.String title,
                                     int messageType,
                                     javax.swing.Icon icon)
Brings up a dialog displaying a message, specifying all parameters.
Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
icon - an icon to display in the dialog that helps the user identify the kind of message that is being displayed.

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComponent,
                                   java.lang.Object message,
                                   java.lang.String title,
                                   int optionType,
                                   int messageType,
                                   javax.swing.Icon icon,
                                   java.lang.Object[] options,
                                   java.lang.Object initialValue)
Brings up a modal dialog with a specified icon, where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter.

If optionType is YES_NO_OPTION, or YES_NO_CANCEL_OPTION and the options parameter is null, then the options are supplied by the look and feel.

The messageType parameter is primarily used to supply a default icon from the look and feel.

Parameters:
parentComponent - Determines the Frame in which the dialog is displayed. If null, or if the parentComponent has no Frame, a default Frame is used.
message - The Object to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an int designating the kind of message this is, primarily used to determine the icon from the pluggable look and feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
icon - the icon to display in the dialog
options - an array of objects indicating the possible choices the user can make. If the objects are components, they are rendered properly. Non-String objects are rendered using their toString methods. If this parameter is null, the options are determined by the look and feel.
initialValue - the object that represents the default selection for the dialog
Returns:
an int indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog