pt.moredata.dataentry.util
Class OptionPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JOptionPane
                  extended bypt.moredata.dataentry.util.OptionPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class OptionPane
extends javax.swing.JOptionPane

Extensao a classe javax.swing.JOptionPane. Os dialogos criados por esta classe possuiem uma checkbox que permitem nao mostrar mais o dialogo. Company MoreData

Version:
$Revision: 1.4 $ TODO: Migrar esta classe para o package pt.moredata.widgets
Author:
psfbc
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JOptionPane
javax.swing.JOptionPane.AccessibleJOptionPane
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OptionPane()
          Creates a OptionPane with a test message.
OptionPane(java.lang.Object message)
          Creates a instance of OptionPane to display a message using the plain-message message type and the default options delivered by the UI.
OptionPane(java.lang.Object message, int messageType)
          Creates an instance of OptionPane to display a message with the specified message type and the default options,
OptionPane(java.lang.Object message, int messageType, int optionType)
          Creates an instance of OptionPane to display a message with the specified message type and options.
OptionPane(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon)
          Creates an instance of OptionPane to display a message with the specified message type, options, and icon.
OptionPane(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon, java.lang.Object[] options)
          Creates an instance of OptionPane to display a message with the specified message type, icon, and options.
OptionPane(java.lang.Object message, int messageType, int optionType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue)
          Creates an instance of OptionPane to display a message with the specified message type, icon, and options, with the initially-selected option specified.
 
Method Summary
static int showConfirmDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a dialog with a specified icon, 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, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a 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, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a dialog where the number of choices is determined by the optionType parameter.
static void showMessageDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType, javax.swing.Icon icon, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a dialog displaying a message, specifying all parameters.
static void showMessageDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int messageType, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
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, java.lang.String dontShowMessage, java.awt.event.ItemListener itemListener)
          Brings up a dialog with a specified icon, where the initial choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.
 
Methods inherited from class javax.swing.JOptionPane
createDialog, 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, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalInputDialog, showInternalInputDialog, showInternalInputDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalOptionDialog, showMessageDialog, showMessageDialog, showMessageDialog, showOptionDialog, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptionPane

public OptionPane()
Creates a OptionPane with a test message.


OptionPane

public OptionPane(java.lang.Object message)
Creates a instance of OptionPane to display a message using the plain-message message type and the default options delivered by the UI.

Parameters:
message - the Object to display

OptionPane

public OptionPane(java.lang.Object message,
                  int messageType)
Creates an instance of OptionPane to display a message with the specified message type and the default options,

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE

OptionPane

public OptionPane(java.lang.Object message,
                  int messageType,
                  int optionType)
Creates an instance of OptionPane to display a message with the specified message type and options.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION

OptionPane

public OptionPane(java.lang.Object message,
                  int messageType,
                  int optionType,
                  javax.swing.Icon icon)
Creates an instance of OptionPane to display a message with the specified message type, options, and icon.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION
icon - the Icon image to display

OptionPane

public OptionPane(java.lang.Object message,
                  int messageType,
                  int optionType,
                  javax.swing.Icon icon,
                  java.lang.Object[] options)
Creates an instance of OptionPane to display a message with the specified message type, icon, and options. None of the options is initially selected.

The options objects should contain either instances of Components, (which are added directly) or Strings (which are wrapped in a JButton). If you provide Components, you must ensure that when the Component is clicked it messages setValue in the created OptionPane.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION
icon - the Icon image to display
options - the choices the user can select

OptionPane

public OptionPane(java.lang.Object message,
                  int messageType,
                  int optionType,
                  javax.swing.Icon icon,
                  java.lang.Object[] options,
                  java.lang.Object initialValue)
Creates an instance of OptionPane to display a message with the specified message type, icon, and options, with the initially-selected option specified.

Parameters:
message - the Object to display
messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - the options to display in the pane: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION
icon - the Icon image to display
options - the choices the user can select
initialValue - the choice that is initially selected; if null, then nothing will be initially selected; only meaningful if options is used
Method Detail

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,
                                   java.lang.String dontShowMessage,
                                   java.awt.event.ItemListener itemListener)
                            throws java.awt.HeadlessException
Brings up a dialog with a specified icon, where the initial choice is determined 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 integer designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an integer 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; only meaningful if options is used; can be null
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message,
                                    java.lang.String title,
                                    int optionType,
                                    java.lang.String dontShowMessage,
                                    java.awt.event.ItemListener itemListener)
                             throws java.awt.HeadlessException
Brings up a 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
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Returns:
an int indicating the option selected by the user
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

showConfirmDialog

public static int showConfirmDialog(java.awt.Component parentComponent,
                                    java.lang.Object message,
                                    java.lang.String title,
                                    int optionType,
                                    int messageType,
                                    java.lang.String dontShowMessage,
                                    java.awt.event.ItemListener itemListener)
                             throws java.awt.HeadlessException
Brings up a 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 integer designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an integer 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
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Returns:
an integer indicating the option selected by the user
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

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,
                                    java.lang.String dontShowMessage,
                                    java.awt.event.ItemListener itemListener)
                             throws java.awt.HeadlessException
Brings up a 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
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Returns:
an int indicating the option selected by the user
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

showMessageDialog

public static void showMessageDialog(java.awt.Component parentComponent,
                                     java.lang.Object message,
                                     java.lang.String title,
                                     int messageType,
                                     java.lang.String dontShowMessage,
                                     java.awt.event.ItemListener itemListener)
                              throws java.awt.HeadlessException
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
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

showMessageDialog

public static void showMessageDialog(java.awt.Component parentComponent,
                                     java.lang.Object message,
                                     java.lang.String title,
                                     int messageType,
                                     javax.swing.Icon icon,
                                     java.lang.String dontShowMessage,
                                     java.awt.event.ItemListener itemListener)
                              throws java.awt.HeadlessException
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
dontShowMessage - The message to be display close to the checkbox that disbles the dialog next time.
itemListener - ItemListener for the dontShowMessage checkbox.
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()