Class ZGStandardDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- com.zerog.awt.ZGStandardDialog
-
- All Implemented Interfaces:
com.zerog.ui.gui.iComponent,com.zerog.ui.gui.iContainer,com.zerog.ui.gui.iStandardDialog,com.zerog.util.events.ZGQuitApprovalListener,java.awt.event.ActionListener,java.awt.event.KeyListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,javax.swing.SwingConstants
public class ZGStandardDialog extends java.awt.Dialog implements java.awt.event.ActionListener, java.awt.event.KeyListener, com.zerog.ui.gui.iStandardDialog, com.zerog.util.events.ZGQuitApprovalListenerProvides a simple way to display a standard Dialog that has a title, label text, narrative text, and between 1 and 3 buttons (typically OK, Cancel, and Details...).
The dialog is laid out such that the the label text is displayed vertically above the narrative text. The label text is displayed using a bold 12-point
Dialogfont. The narrative text is displayed using a plain 10-pointSansSeriffont. To the left of the text is a dialog icon (by default an alert icon).The components used to display the label and narrative text provide automatic text wrap capabilities
The dialog can have up to 3 buttons. By default, only the 'default' button is visible (it has a default label of 'OK').
When the dialog is first shown, the 'default' button is given focus and the dialog is centered on the user's screen (slightly off-center toward the top vertically). Each of the dialogs buttons can be activated, provided that they have focus, by the user pressing the 'Enter' key.
This dialog is available to all InstallAnywhere-based installers (including the pure Java installer), as well as, all LaunchAnywhere-based Java applications.
- See Also:
Dialog, Serialized Form
-
-
Nested Class Summary
-
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, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description static intERROR-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied parentFrame, label, and narrative text.ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied parentFrame, title, label, and narrative text.ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText, int alertLevel)Constructs an initially invisible ZGStandardDialog with the supplied parentFrame, title, label, narrative text, and alert level.ZGStandardDialog(java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied label and narrative text.ZGStandardDialog(java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied title, label, and narrative text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)voidaddActionListener(java.awt.event.ActionListener al)This method adds the specified action listener to receive action events from this dialog.voidcenterOnScreen()A Utility method to center the dialog with respect to its parent Frame (or to center it absolutely if the parent Frame is not visible).intgetLastButtonPressed()This method provides a mechanism for the developer to determine which of the buttons was pressed to dismiss the dialog.voidhide()voidkeyPressed(java.awt.event.KeyEvent e)voidkeyReleased(java.awt.event.KeyEvent ke)voidkeyTyped(java.awt.event.KeyEvent e)booleanquitApprovalRequested()ZGQuitApprovalListener methodvoidremoveActionListener(java.awt.event.ActionListener al)This method removes the specified action listener so that it no longer receives action events from from this dialog.voidsetAlertLevel(int alertLevel)This method provides a mechanism for the developer to specify the alert level for the dialog.voidsetCancelButtonLabel(java.lang.String newLabel)This method provides a mechanism for the developer to specify the label the 'cancel' button should display.voidsetCancelButtonVisible(boolean visible)This method provides a mechanism for the developer to specify whether the 'cancel' button should be visible or not in the dialog.voidsetDefaultButtonLabel(java.lang.String newLabel)This method provides a mechanism for the developer to specify the label the 'default' button should display.voidsetDetailsButtonLabel(java.lang.String newLabel)This method provides a mechanism for the developer to specify the label the 'details' button should display.voidsetDetailsButtonVisible(boolean visible)This method provides a mechanism for the developer to specify whether the 'details' button should be visible or not in the dialog.voidsetImage(java.awt.Image newImage)This method provides a mechanism for the developer to specify the image that should be used as the dialog's icon.voidsetModal(boolean modal)Specifies whether this dialog is modal.voidsetVisible(boolean visible)Makes the component visible or invisible.voidshow()-
Methods inherited from class java.awt.Dialog
addNotify, getAccessibleContext, getModalityType, getTitle, isModal, isResizable, isUndecorated, paramString, setBackground, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, 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
-
Methods inherited from interface com.zerog.ui.gui.iComponent
doLayout, getBackground, getFont, getForeground, getName, getParent, getSize, isEnabled, isShowing, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFont, setForeground, setLocation, setName, setSize, setSize, transferFocus, validate
-
-
-
-
Field Detail
-
ERROR
public static final int ERROR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZGStandardDialog
public ZGStandardDialog(java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied label and narrative text.
The dialog is set with the following defaults:
- the alert level is set to WARNING
- the title is set to "Alert"
- the dialog is set to be modal
- the dialog is set to be non-resizable
- a new Frame, which is invisible, is instantiated as the dialogs parent.- Parameters:
labelText- the text to be used as the 'label' for the dialog.narrativeText- the text to be used as the 'narrative' for the dialog.- See Also:
setModal(boolean),Dialog.setResizable(boolean)
-
ZGStandardDialog
public ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied parent
Frame, label, and narrative text.The dialog is set with the following defaults:
- the alert level is set to WARNING
- the title is set to "Alert"
- the dialog is set to be modal
- the dialog is set to be non-resizable- Parameters:
parentFrame- the owner of the dialoglabelText- the text to be used as the 'label' for the dialog.narrativeText- the text to be used as the 'narrative' for the dialog.- See Also:
setModal(boolean),Dialog.setResizable(boolean)
-
ZGStandardDialog
public ZGStandardDialog(java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied title, label, and narrative text.
The dialog is set with the following defaults:
- the alert level is set to WARNING
- the dialog is set to be modal
- the dialog is set to be non-resizable
- a new Frame, which is invisible, is instantiated as the dialogs parent.- Parameters:
dialogTitle- the title of the dialog.labelText- the text to be used as the 'label' for the dialog.narrativeText- the text to be used as the 'narrative' for the dialog.- See Also:
setModal(boolean),Dialog.setResizable(boolean)
-
ZGStandardDialog
public ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText)Constructs an initially invisible ZGStandardDialog with the supplied parent
Frame, title, label, and narrative text.The dialog is set with the following defaults:
- the alert level is set to WARNING
- the dialog is set to be modal
- the dialog is set to be non-resizable- Parameters:
parentFrame- the owner of the dialogdialogTitle- the title of the dialog.labelText- the text to be used as the 'label' for the dialog.narrativeText- the text to be used as the 'narrative' for the dialog.- See Also:
setModal(boolean),Dialog.setResizable(boolean)
-
ZGStandardDialog
public ZGStandardDialog(java.awt.Frame parentFrame, java.lang.String dialogTitle, java.lang.String labelText, java.lang.String narrativeText, int alertLevel)Constructs an initially invisible ZGStandardDialog with the supplied parent
Frame, title, label, narrative text, and alert level.The dialog is set with the following defaults:
- the dialog is set to be modal
- the dialog is set to be non-resizable- Parameters:
parentFrame- the owner of the dialogdialogTitle- the title of the dialog.labelText- the text to be used as the 'label' for the dialog.narrativeText- the text to be used as the 'narrative' for the dialog.alertLevel- the Alert Level to be used to determine the default dialog icon.- See Also:
setModal(boolean),Dialog.setResizable(boolean)
-
-
Method Detail
-
setModal
public void setModal(boolean modal)
Specifies whether this dialog is modal.
A modal
Dialoggrabs all the input to the parent frame from the user.- Specified by:
setModalin interfacecom.zerog.ui.gui.iStandardDialog- Overrides:
setModalin classjava.awt.Dialog- Parameters:
modal- abooleanvalue that indicates whether or not the dialog should be modal.
-
quitApprovalRequested
public boolean quitApprovalRequested()
ZGQuitApprovalListener method- Specified by:
quitApprovalRequestedin interfacecom.zerog.util.events.ZGQuitApprovalListener
-
setVisible
public void setVisible(boolean visible)
Makes the component visible or invisible.
Overrides Component.setVisible.
- Specified by:
setVisiblein interfacecom.zerog.ui.gui.iComponent- Overrides:
setVisiblein classjava.awt.Dialog- Parameters:
visible- - true to make the component visible.
-
show
public void show()
- Specified by:
showin interfacecom.zerog.ui.gui.iComponent- Overrides:
showin classjava.awt.Dialog
-
hide
public void hide()
- Overrides:
hidein classjava.awt.Dialog
-
setDetailsButtonVisible
public void setDetailsButtonVisible(boolean visible)
This method provides a mechanism for the developer to specify whether the 'details' button should be visible or not in the dialog.
By default the 'details' button is not visible
- Specified by:
setDetailsButtonVisiblein interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
visible- abooleanvalue that indicates whether or not the 'details' button should be visible or not.- See Also:
setDetailsButtonLabel(String),setCancelButtonVisible(boolean)
-
setCancelButtonVisible
public void setCancelButtonVisible(boolean visible)
This method provides a mechanism for the developer to specify whether the 'cancel' button should be visible or not in the dialog.
By default the 'cancel' button is not visible
- Specified by:
setCancelButtonVisiblein interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
visible- abooleanvalue that indicates whether or not the 'cancel' button should be visible or not.- See Also:
setCancelButtonLabel(String),setDetailsButtonVisible(boolean)
-
setDefaultButtonLabel
public void setDefaultButtonLabel(java.lang.String newLabel)
This method provides a mechanism for the developer to specify the label the 'default' button should display.
The default label for the 'default' button is 'OK'
- Specified by:
setDefaultButtonLabelin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
newLabel- aStringvalue that represents the new label for the 'default' button.- See Also:
setCancelButtonLabel(String),setDetailsButtonLabel(String)
-
setCancelButtonLabel
public void setCancelButtonLabel(java.lang.String newLabel)
This method provides a mechanism for the developer to specify the label the 'cancel' button should display.
The default label for the 'cancel' button is 'Cancel'
- Specified by:
setCancelButtonLabelin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
newLabel- aStringvalue that represents the new label for the 'cancel' button.- See Also:
setDefaultButtonLabel(String),setDetailsButtonLabel(String)
-
setDetailsButtonLabel
public void setDetailsButtonLabel(java.lang.String newLabel)
This method provides a mechanism for the developer to specify the label the 'details' button should display.
The default label for the 'details' button is 'Details...'
- Specified by:
setDetailsButtonLabelin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
newLabel- aStringvalue that represents the new label for the 'details' button.- See Also:
setDefaultButtonLabel(String),setCancelButtonLabel(String)
-
setAlertLevel
public void setAlertLevel(int alertLevel)
This method provides a mechanism for the developer to specify the alert level for the dialog. The alert level for the dialog indicates which of the default alert icons the dialog should display.
The method overrides any prior calls made to
setImage(). Likewise, later calls to setImage() will override settings made by calling this method.- Specified by:
setAlertLevelin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
alertLevel- anintvalue that represents the message alert level for this dialog. Possible values include:WARNING,ERROR,INFORMATION, andQUERY.- See Also:
setImage(Image)
-
setImage
public void setImage(java.awt.Image newImage)
This method provides a mechanism for the developer to specify the image that should be used as the dialog's icon.
The default image for a ZGStandardDialog is a yellow triangular Alert icon featuring an exclamation point (WARNING alert level). 32 x 32 pixel images are recommended.
The method overrides any prior calls made to
setAlertLevel(). Likewise, later calls to setAlertLevel() will override settings made by calling this method.- Specified by:
setImagein interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
newImage- aImagevalue that represents the new icon to be used by the dialog.- See Also:
setAlertLevel(int)
-
centerOnScreen
public void centerOnScreen()
A Utility method to center the dialog with respect to its parent Frame (or to center it absolutely if the parent Frame is not visible).
-
addActionListener
public void addActionListener(java.awt.event.ActionListener al)
This method adds the specified action listener to receive action events from this dialog.
Action events occur when a user dismisses the dialog by pressing any of the visible buttons that are part of the dialog.
- Specified by:
addActionListenerin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
al- theActionListenerto be added.
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener al)
This method removes the specified action listener so that it no longer receives action events from from this dialog.
Action events occur when a user dismisses the dialog by pressing any of the visible buttons that are part of the dialog.
- Specified by:
removeActionListenerin interfacecom.zerog.ui.gui.iStandardDialog- Parameters:
al- theActionListenerto be removed.
-
getLastButtonPressed
public int getLastButtonPressed()
This method provides a mechanism for the developer to determine which of the buttons was pressed to dismiss the dialog.
This is particularly useful when the dialog is modal (the default behavior). After the dialog is set visible, it will block until dismissed. Once the user has dismissed the dialog and control returns to the application, this method can be called to determine which button the user chose to dismiss the dialog.
- Specified by:
getLastButtonPressedin interfacecom.zerog.ui.gui.iStandardDialog- Returns:
- an int representing the button that was pressed by the user to
dismiss the dialog. Possible values include:
DEFAULT_BUTTON,CANCEL_BUTTON,DETAILS_BUTTON, andNO_BUTTON_PRESSED.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
- Specified by:
keyPressedin interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent ke)
- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
-