PIRL

PIRL.Viewers
Class Dialog_Box

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JOptionPane
                  extended by PIRL.Viewers.Dialog_Box
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Dialog_Box
extends JOptionPane

The Dialog_Box class provides a collection of static methods that are convenient for producing commonly used Dialog_Boxes.

Version:
1.12
Author:
Bradford Castalia, UA/PIRL
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JOptionPane
JOptionPane.AccessibleJOptionPane
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int MAX_LINE_LENGTH
          The maximum number of characters per line in a dialog box.
 
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
 
Method Summary
static int Check(String message)
          Displays a ConfirmDialog box centered on the screen with a "Check" title and a Yes, No and Cancel button.
static int Check(String message, Component parent)
          Displays a ConfirmDialog box with a "Check" title and a Yes, No and Cancel button.
static boolean Confirm(String message)
          Displays a ConfirmDialog box centered on the screen with a "Confirm" title and an OK and Cancel button.
static boolean Confirm(String message, Component parent)
          Displays a ConfirmDialog box with a "Confirm" title and an OK and Cancel button.
static void Error(String message)
          Displays an ERROR_MESSAGE MessageDialog box centered on the screen, preceeded by an audible beep, with an "Error" title and an OK button.
static void Error(String message, Component parent)
          Displays an ERROR_MESSAGE MessageDialog box, preceeded by an audible beep, with an "Error" title and an OK button.
static String Fit_to_Width(String string)
          Fits a String to the MAX_LINE_LENGTH.
static String Fit_to_Width(String in_string, int width)
          Fits (wraps using NL sequences) a String to a given width.
static void Notice(String message)
          Displays an INFORMATION_MESSAGE MessageDialog box centered on the screen with a "Notice" title and an OK button.
static void Notice(String message, Component parent)
          Displays an INFORMATION_MESSAGE MessageDialog box with a "Notice" title and an OK button.
static String Password(String prompt)
          Displays a Password_Dialog with a password input field preceded by a prompt.
static String Password(String prompt, Frame parent)
          Displays a Password_Dialog with a password input field preceded by a prompt.
static void Warning(String message)
          Displays a WARNING_MESSAGE MessageDialog box centered on the screen, preceeded by an audible beep, with a "Warning" title and an OK button.
static void Warning(String message, Component parent)
          Displays a WARNING_MESSAGE MessageDialog box, preceeded by an audible beep, with a "Warning" title and an OK button.
 
Methods inherited from class javax.swing.JOptionPane
createDialog, 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, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
 

Field Detail

MAX_LINE_LENGTH

public static int MAX_LINE_LENGTH
The maximum number of characters per line in a dialog box. A width <= 0 is an unlimited width.

Method Detail

Notice

public static void Notice(String message,
                          Component parent)
Displays an INFORMATION_MESSAGE MessageDialog box with a "Notice" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.
parent - The parent Component relative to which the dialog box will be positioned. This may be null in which case the Dialog_Box will be centered on the display.

Notice

public static void Notice(String message)
Displays an INFORMATION_MESSAGE MessageDialog box centered on the screen with a "Notice" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.

Warning

public static void Warning(String message,
                           Component parent)
Displays a WARNING_MESSAGE MessageDialog box, preceeded by an audible beep, with a "Warning" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.
parent - The parent Component relative to which the dialog box will be positioned. This may be null in which case the Dialog_Box will be centered on the display.

Warning

public static void Warning(String message)
Displays a WARNING_MESSAGE MessageDialog box centered on the screen, preceeded by an audible beep, with a "Warning" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.

Error

public static void Error(String message,
                         Component parent)
Displays an ERROR_MESSAGE MessageDialog box, preceeded by an audible beep, with an "Error" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.
parent - The parent Component relative to which the dialog box will be positioned. This may be null in which case the Dialog_Box will be centered on the display.

Error

public static void Error(String message)
Displays an ERROR_MESSAGE MessageDialog box centered on the screen, preceeded by an audible beep, with an "Error" title and an OK button.

Parameters:
message - A String message that will be displayed in the dialog box.

Confirm

public static boolean Confirm(String message,
                              Component parent)
Displays a ConfirmDialog box with a "Confirm" title and an OK and Cancel button.

Parameters:
message - A String message that will be displayed in the dialog box.
parent - The parent Component relative to which the dialog box will be positioned. This may be null in which case the Dialog_Box will be centered on the display.
Returns:
true if the OK button was pressed; false otherwise.

Confirm

public static boolean Confirm(String message)
Displays a ConfirmDialog box centered on the screen with a "Confirm" title and an OK and Cancel button.

Parameters:
message - A String message that will be displayed in the dialog box.
Returns:
true if the OK button was pressed; false otherwise.

Check

public static int Check(String message,
                        Component parent)
Displays a ConfirmDialog box with a "Check" title and a Yes, No and Cancel button.

Parameters:
message - A String message that will be displayed in the dialog box.
parent - The parent Component relative to which the dialog box will be positioned. This may be null in which case the Dialog_Box will be centered on the display.
Returns:
1 if the Yes button was pressed, -1 if the No button was pressed, or 0 if the Cancel button was pressed.

Check

public static int Check(String message)
Displays a ConfirmDialog box centered on the screen with a "Check" title and a Yes, No and Cancel button.

Parameters:
message - A String message that will be displayed in the dialog box.
Returns:
1 if the Yes button was pressed, -1 if the No button was pressed, or 0 if the Cancel button was pressed.

Password

public static String Password(String prompt,
                              Frame parent)
Displays a Password_Dialog with a password input field preceded by a prompt.

Parameters:
prompt - The text preceding the password input field. If null, "Password" will be used by default.
parent - The parent Frame relative to which the dialog box will be positioned. This may be null.

Password

public static String Password(String prompt)
Displays a Password_Dialog with a password input field preceded by a prompt.

Parameters:
prompt - The text preceding the password input field. If null, "Password" will be used by default.

Fit_to_Width

public static String Fit_to_Width(String in_string,
                                  int width)
Fits (wraps using NL sequences) a String to a given width.

A NL replaces the last whitespace sequence before the width of the current line is reached. If there is no whitespace, then the NL is inserted at the width. A width <= 0 is an unlimited width.


Fit_to_Width

public static String Fit_to_Width(String string)
Fits a String to the MAX_LINE_LENGTH.

Parameters:
string - The String to be fitted.
Returns:
The fitted String.
See Also:
Fit_to_Width(String, int)

PIRL

Copyright (C) \ 2003-2009 Bradford Castalia, University of Arizona