IcanGui
Class IcanButtonDialog

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 IcanGui.IcanButtonDialog
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class IcanButtonDialog
extends java.awt.Dialog
implements java.awt.event.ActionListener, java.awt.event.KeyListener

Encapsulate the behavior of dialog window action/event handling.

Since:
1.0;
Version:
1.1.6;
Updated by Louis Handler on Oct 11, 2005, 08:23 EDT (1.1.6).
Updated by Louis Handler on Jul 18, 2005, 09:40 EDT (1.1.5).
Updated by Louis Handler on Oct 29, 2004, 11:46 EDT (1.0.10).
Updated by Louis Handler on Apr 26, 2004, 14:41 EDT (1.0.6).
Updated by Louis Handler on Aug 27, 2002, 12:54 EDT.
Updated by Louis Handler on Aug 27, 2002, 09:46 EDT.
Updated by Louis Handler on Aug 23, 2002, 15:55 EDT.
Updated by Louis Handler on Aug 23, 2002, 14:18 EDT.
Updated by Louis Handler on Mar 30, 2000, 09:31 EST.
Updated by Louis Handler on Feb 22, 2000, 15:21 EST.
Updated by Louis Handler on Oct 28, 1999, 11:14 EDT.
Updated by Louis Handler on Jan 5, 1999, 14:37 EST.
Updated by Louis Handler on Oct 20, 1998, 10:37 EDT.
Updated by Louis Handler on Aug 28, 1998, 15:10 EDT.
Updated by Louis Handler on Jul 21, 1998, 08:51 EDT.
Updated by Matthew Der on Jul 6, 1998.
Updated by Matthew Der on Jun 24, 1998.
Updated by Louis Handler on Jun 18, 1998.
Author:
Louis Handler
See Also:
Serialized Form

Nested Class Summary
(package private)  class IcanButtonDialog.Madapter
          Mouse Adapter Inner Class
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.awt.Button[] bs
          Array of button(s) used to respond to query.
private static boolean circular
          True, if help about help is attempted.
private  int click
          Number of the button clicked (0 - N-1).
private  int focus
          Subscript of current focus.
private  int maxwidth
          Maximum size of the buttons based on the text length.
private  IcanButtonDialog.Madapter myMadapter
          Mouse Adapter to handle mouse entering the window for the first time and right clicks.
private  int nCol
          Number of columns of buttons.
private  int nRow
          Number of rows of buttons.
private  java.awt.Panel panelFrame
          The Panel that contains the data to be displayed within a scrolling frame.
private  java.awt.Component saveCompFocus
          Component having focus.
private  java.awt.ScrollPane scrollFrame
          The scrolling frame in which the data is displayed.
private  java.awt.Font taFont
          Font to be used on text area; however, if null, use default font from GuiGlobals.
private  java.awt.TextArea tArea
          TextArea containing a query to respond to by clicking a button.
private  java.lang.String text
          Text of a query to respond to by clicking a button.
private  IcanButtonDialog windowFrame
          Current window Frame.
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
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
IcanButtonDialog(IcanFrame parent, java.lang.String frameTitle, java.lang.String text, java.lang.String label1)
          Constructor creates dialog window with a title.
IcanButtonDialog(IcanFrame parent, java.lang.String frameTitle, java.lang.String text, java.lang.String[] labels)
          Constructor creates dialog window with a title.
IcanButtonDialog(IcanFrame parent, java.lang.String frameTitle, java.lang.String text, java.lang.String label1, java.lang.String label2)
          Constructor creates dialog window with a title.
IcanButtonDialog(IcanFrame parent, java.lang.String frameTitle, java.lang.String text, java.lang.String label1, java.lang.String label2, java.lang.String label3)
          Constructor creates dialog window with a title.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Detect Action Events and process accordingly
 void enableButton(boolean enable, int ib)
          Enable or disable a button.
 int getClick()
          Get number of button clicked (0 - N-1).
 java.lang.String getName()
          Get class name.
 void helpMe()
          Display help message.
 void keyPressed(java.awt.event.KeyEvent evt)
          Does Nothing
 void keyReleased(java.awt.event.KeyEvent evt)
          Detects when the following keys are released from the keyboard: Shift+Tab, Tab, Enter, Up Arrow, Down Arrow F1, Alt+Right, Alt+Left, Ctrl-End, and Ctrl-Home
 void keyTyped(java.awt.event.KeyEvent evt)
          Does Nothing
 void remove()
          Dispose of any components required before disposing of parent.
 void setCompFocus()
          Set focus when mouse enters window.
 void setCompFocus(java.awt.Component cfocus)
          Set focus to given component.
 void setFont(java.awt.Font font)
          Set font to be used on text area.
 void setSizeX()
          Set size of this window based on latest font size and amount of text.
 
Methods inherited from class java.awt.Dialog
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, getBaseline, getBaselineResizeBehavior, 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, 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, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

windowFrame

private IcanButtonDialog windowFrame
Current window Frame.


text

private java.lang.String text
Text of a query to respond to by clicking a button.

See Also:
tArea

tArea

private java.awt.TextArea tArea
TextArea containing a query to respond to by clicking a button.

See Also:
text

taFont

private java.awt.Font taFont
Font to be used on text area; however, if null, use default font from GuiGlobals.


bs

private java.awt.Button[] bs
Array of button(s) used to respond to query.


maxwidth

private int maxwidth
Maximum size of the buttons based on the text length. Used to compute number of rows and columns of buttons.

See Also:
nRow, nCol

nRow

private int nRow
Number of rows of buttons.

See Also:
maxwidth

nCol

private int nCol
Number of columns of buttons.

See Also:
maxwidth

scrollFrame

private java.awt.ScrollPane scrollFrame
The scrolling frame in which the data is displayed.


panelFrame

private java.awt.Panel panelFrame
The Panel that contains the data to be displayed within a scrolling frame.


myMadapter

private IcanButtonDialog.Madapter myMadapter
Mouse Adapter to handle mouse entering the window for the first time and right clicks.


click

private int click
Number of the button clicked (0 - N-1). The variable is set to -1, if no button clicked.


focus

private int focus
Subscript of current focus.


circular

private static boolean circular
True, if help about help is attempted.


saveCompFocus

private java.awt.Component saveCompFocus
Component having focus.

Constructor Detail

IcanButtonDialog

public IcanButtonDialog(IcanFrame parent,
                        java.lang.String frameTitle,
                        java.lang.String text,
                        java.lang.String label1)
Constructor creates dialog window with a title.

Parameters:
parent - Parent/owner of dialog.
frameTitle - Title to display at top of window.
text - Text to display in TextArea before accepting a response in the form of a button click.
label1 - String to display on button 1.

IcanButtonDialog

public IcanButtonDialog(IcanFrame parent,
                        java.lang.String frameTitle,
                        java.lang.String text,
                        java.lang.String label1,
                        java.lang.String label2)
Constructor creates dialog window with a title.

Parameters:
parent - Title to display at top of window.
frameTitle - Title to display at top of window.
text - Text to display in TextArea before accepting a response in the form of a button click.
label1 - String to display on button 1.
label2 - String to display on button 2.

IcanButtonDialog

public IcanButtonDialog(IcanFrame parent,
                        java.lang.String frameTitle,
                        java.lang.String text,
                        java.lang.String label1,
                        java.lang.String label2,
                        java.lang.String label3)
Constructor creates dialog window with a title.

Parameters:
parent - Title to display at top of window.
frameTitle - Title to display at top of window.
text - Text to display in TextArea before accepting a response in the form of a button click.
label1 - String to display on button 1.
label2 - String to display on button 2.
label3 - String to display on button 3.

IcanButtonDialog

public IcanButtonDialog(IcanFrame parent,
                        java.lang.String frameTitle,
                        java.lang.String text,
                        java.lang.String[] labels)
Constructor creates dialog window with a title.

Parameters:
parent - Title to display at top of window.
frameTitle - Title to display at top of window.
text - Text to display in TextArea before accepting a response in the form of a button click.
labels - Array of strings to display on buttons.
Method Detail

setSizeX

public void setSizeX()
Set size of this window based on latest font size and amount of text.

See Also:
nRow, nCol, maxwidth

setFont

public void setFont(java.awt.Font font)
Set font to be used on text area. If null, use default font from GuiGlobals.

Overrides:
setFont in class java.awt.Container
Parameters:
font - If null, reset to use default font in GuiGlobals; else, use this font.

enableButton

public void enableButton(boolean enable,
                         int ib)
Enable or disable a button. For consistency, the user may want to leave a button on the screen even though the button should not be used. A disabled button will be greyed out and not usable.


remove

public void remove()
Dispose of any components required before disposing of parent.


getClick

public int getClick()
Get number of button clicked (0 - N-1).

Returns:
Number of the button clicked (0 - N-1). -1, if no button clicked.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Detect Action Events and process accordingly

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

setCompFocus

public void setCompFocus()
Set focus when mouse enters window.


setCompFocus

public void setCompFocus(java.awt.Component cfocus)
Set focus to given component.

Parameters:
cfocus - Component to give focus to.

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Detects when the following keys are released from the keyboard: Shift+Tab, Tab, Enter, Up Arrow, Down Arrow F1, Alt+Right, Alt+Left, Ctrl-End, and Ctrl-Home

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Does Nothing

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Does Nothing

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

helpMe

public void helpMe()
Display help message.


getName

public java.lang.String getName()
Get class name.

Overrides:
getName in class java.awt.Component
Returns:
Class name.