anecho.gui
Class OKBox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by anecho.gui.OKBox
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class OKBox
extends java.awt.Dialog
implements java.awt.event.ActionListener

The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ALERT_ICON
          Show an "Alert" icon in the message box.
static java.lang.String CANCEL
          Cancel Button
static int CUSTOM_ICON
          Show a custom icon in the dialogue box.
static int INFORMATION_ICON
          Show an "information" icon in the dialogue box.
static int NO_ICON
          Do not show an icon in the message box
static java.lang.String OKAY
          Okay button
static int QUESTION_ICON
          Show a custom icon in the message box
 
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
OKBox(java.awt.Frame parent)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, boolean modalBox)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title, boolean modalBox)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title, boolean modalBox, java.lang.String boxMessage)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title, boolean modalBox, java.lang.String boxMessage, int iconType)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title, boolean modalBox, java.lang.String boxMessage, int iconType, java.lang.String buttons)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
OKBox(java.awt.Frame parent, java.lang.String title, boolean modalBox, java.lang.String boxMessage, java.lang.String buttons)
          The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          This method captures the button that was pressed by the user and records the information internally.
 void addButton(java.lang.String name)
          Add a button to the list of buttons to be displayed
 void append(java.lang.String text)
          Append a line of text to a message, or create a new message if one does not exist
 java.lang.String getResult()
          Return the user's selection.
 void paint(java.awt.Graphics iconGraph)
          Paint a given icon to the dialogue
 void setText(java.lang.String text)
          Set the text for the message (erasing any previous contents)
 void setVisible(boolean status)
          Allow the dialogue box to be shown or hidden
 void show()
          Deprecated. This method is deprecated
 void showCentered()
          This functions the same as the show command except for the fact that it automatically centres the dialogue over its parent
 void showCentred()
          Deprecated. use showCentered() instead
 
Methods inherited from class java.awt.Dialog
addNotify, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ICON

public static final int NO_ICON
Do not show an icon in the message box

See Also:
Constant Field Values

CUSTOM_ICON

public static final int CUSTOM_ICON
Show a custom icon in the dialogue box.

See Also:
Constant Field Values

QUESTION_ICON

public static final int QUESTION_ICON
Show a custom icon in the message box

See Also:
Constant Field Values

ALERT_ICON

public static final int ALERT_ICON
Show an "Alert" icon in the message box.

See Also:
Constant Field Values

INFORMATION_ICON

public static final int INFORMATION_ICON
Show an "information" icon in the dialogue box.

See Also:
Constant Field Values

OKAY

public static final java.lang.String OKAY
Okay button


CANCEL

public static final java.lang.String CANCEL
Cancel Button

Constructor Detail

OKBox

public OKBox(java.awt.Frame parent)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
parent - The parent frame for this dialogue

OKBox

public OKBox(java.awt.Frame parent,
             boolean modalBox)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
parent - The parent frame for this dialogue
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
title - Title to be used for this dialogue
parent - The parent frame for this dialogue

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title,
             boolean modalBox)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
parent - The parent frame of this dialogue
title - The title for this dialog
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title,
             boolean modalBox,
             java.lang.String boxMessage)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
title - Title of this dialogue
boxMessage - Message to be displayed in this dialogue
parent - The parent frame for this dialogue
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title,
             boolean modalBox,
             java.lang.String boxMessage,
             int iconType)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
title - Title of this dialogue
boxMessage - Message to be displayed by this dialogue
iconType - The type of icon to be displayed by this dialogue
parent - The parent frame for this dialogue
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title,
             boolean modalBox,
             java.lang.String boxMessage,
             java.lang.String buttons)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
title - The title to be displayed by this dialogue
boxMessage - The message to be displayed by this dialogue
buttons - The buttons to be displayed on this dialogue box.
parent - The parent frame for this dialogue
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal

OKBox

public OKBox(java.awt.Frame parent,
             java.lang.String title,
             boolean modalBox,
             java.lang.String boxMessage,
             int iconType,
             java.lang.String buttons)
The Reusable dialogue box: OKBox.java displays program messages to the user with the possibility of including icons, text, and/or response buttons

Parameters:
title - The title to be used by this dialogue box
boxMessage - The message to be displayed by this dialogue box.
iconType - The icon type to be used by this dialogue
buttons - The buttons to be used by this dialogue
parent - The parent frame for this dialogue
modalBox - Indicate the modal status of this dialogue true - Dialogue is modal false - Dialogue is non-modal
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
This method captures the button that was pressed by the user and records the information internally. The dialogue is the set to be hidden.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event -

paint

public void paint(java.awt.Graphics iconGraph)
Paint a given icon to the dialogue

Overrides:
paint in class java.awt.Container
Parameters:
iconGraph - The graphic area we are working with.

setText

public void setText(java.lang.String text)
Set the text for the message (erasing any previous contents)

Parameters:
text - The text to display in our dialogue box.

addButton

public void addButton(java.lang.String name)
Add a button to the list of buttons to be displayed

Parameters:
name - Name of the button to add to our dialogue

append

public void append(java.lang.String text)
Append a line of text to a message, or create a new message if one does not exist

Parameters:
text - Text to be appended to the dialogue

getResult

public java.lang.String getResult()
Return the user's selection. This may be a little tricky as We are not necessarily confined to simply having "Okay" and "Cancel" buttons. This dialogue is extensible!

Returns:
A string indicated the user's button choice.

show

public void show()
Deprecated. This method is deprecated

Override Dialog's 'show' command so that we can format text first!

Overrides:
show in class java.awt.Dialog

setVisible

public void setVisible(boolean status)
Allow the dialogue box to be shown or hidden

Overrides:
setVisible in class java.awt.Component
Parameters:
status - true - make this dialogue visible false - hide this dialogue

showCentred

public void showCentred()
Deprecated. use showCentered() instead

This functions the same as the show command except for the fact that it automatically centres the dialogue over its parent


showCentered

public void showCentered()
This functions the same as the show command except for the fact that it automatically centres the dialogue over its parent