public class StringDialog extends StandardDialog implements java.awt.event.ActionListener, java.awt.event.WindowListener
A simple customizable dialog with support for a variety of data field components.
For simple dialogs, use the included constructors. For more
complicated dialogs, including check boxes, choice lists, and text
fields, use a DialogRsrc object
to pass in a pre-defined dialog definition.
The ShowDialog method shows the current dialog, and returns a Hashtable of results, which map the label used in the dialog for individual data fields with the value entered into that field.
DialogRsrc,
Serialized FormStandardDialog.ModalityTypejavax.swing.JDialog.AccessibleJDialogjava.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionTypejava.awt.Window.AccessibleAWTWindow, java.awt.Window.Type| Modifier and Type | Field and Description |
|---|---|
(package private) javax.swing.JPanel |
buttonPanel |
(package private) static java.lang.String |
cancel |
(package private) javax.swing.JButton |
CancelButton |
(package private) java.awt.GridBagConstraints |
compgbc |
(package private) java.awt.GridBagLayout |
compgbl |
(package private) java.util.Hashtable |
componentHash |
(package private) java.util.Vector |
components |
(package private) javax.swing.JPanel |
dataPanel |
(package private) static boolean |
debug |
(package private) boolean |
done |
(package private) java.awt.GridBagConstraints |
gbc |
(package private) java.awt.GridBagLayout |
gbl |
(package private) java.awt.Image |
image |
(package private) javax.swing.JLabel |
imageCanvas |
(package private) javax.swing.JPanel |
mainPanel |
(package private) java.util.Vector |
objects |
(package private) static java.lang.String |
ok |
(package private) javax.swing.JButton |
OKButton |
(package private) javax.swing.JPanel |
panel |
(package private) DialogRsrc |
resource |
(package private) JMultiLineLabel |
textLabel |
(package private) static TranslationService |
ts
TranslationService object for handling string localization in
the Ganymede server.
|
(package private) java.util.Hashtable |
valueHash |
accessibleContext, rootPane, rootPaneCheckingEnabledBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
StringDialog(DialogRsrc Resource,
StandardDialog.ModalityType modality)
Constructor for more complicated StringDialog.
|
StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
boolean ShowCancel,
StandardDialog.ModalityType modality)
Simple constructor for a small dialog box
|
StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
StandardDialog.ModalityType modality)
Simple constructor for a small dialog box with a Cancel button
|
StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
java.lang.String OK,
java.lang.String Cancel,
java.awt.Image image,
StandardDialog.ModalityType modality)
Simple constructor for a small dialog box
|
StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
java.lang.String OK,
java.lang.String Cancel,
StandardDialog.ModalityType modality)
Simple constructor for a small dialog box
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handle the ok and cancel buttons.
|
private void |
addRow(javax.swing.JPanel parent,
javax.swing.JComponent comp,
java.lang.String label,
int row)
Convenience method to add a GUI component to this dialog.
|
private void |
create() |
private javax.swing.JPanel |
createElementPanel() |
static java.lang.String |
getDefaultCancel()
Returns the localized Cancel string for the language used by the
client's Java environment.
|
static java.lang.String |
getDefaultOk()
Returns the localized Ok string for the language used by the
client's Java environment.
|
java.awt.Dimension |
getPreferredSize() |
private void |
loadValueHash()
This method is responsible for scanning all of the input fields
in this dialog and loading their values into valueHash for
showDialog() to return.
|
protected void |
registerCallbacks()
We want to make it so that when the user hits enter on the last
string or password field in the dialog, the ok button is clicked.
|
void |
setFont(java.awt.Font font) |
void |
setWrapLength(int wrapLength)
Set the word wrap length of the main text area in this StringDialog.
|
java.util.Hashtable |
showDialog()
Display the dialog box, locks this thread while the dialog is being
displayed, and returns a hashtable of data field values when the
user closes the dialog box.
|
void |
windowActivated(java.awt.event.WindowEvent event) |
void |
windowClosed(java.awt.event.WindowEvent event) |
void |
windowClosing(java.awt.event.WindowEvent event) |
void |
windowDeactivated(java.awt.event.WindowEvent event) |
void |
windowDeiconified(java.awt.event.WindowEvent event) |
void |
windowIconified(java.awt.event.WindowEvent event) |
void |
windowOpened(java.awt.event.WindowEvent event) |
isMacSheet, isRunningOnMac, setModality, setVisibleaddImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackaddPropertyChangeListener, 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, 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, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeaction, 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, getGraphicsConfiguration, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclestatic final boolean debug
static final TranslationService ts
TranslationService object for handling string localization in the Ganymede server.
static final java.lang.String ok
static final java.lang.String cancel
DialogRsrc resource
java.util.Hashtable componentHash
java.util.Hashtable valueHash
boolean done
javax.swing.JLabel imageCanvas
javax.swing.JButton OKButton
javax.swing.JButton CancelButton
javax.swing.JPanel panel
javax.swing.JPanel mainPanel
javax.swing.JPanel dataPanel
javax.swing.JPanel buttonPanel
JMultiLineLabel textLabel
java.awt.GridBagLayout gbl
java.awt.GridBagLayout compgbl
java.awt.GridBagConstraints gbc
java.awt.GridBagConstraints compgbc
java.awt.Image image
java.util.Vector objects
java.util.Vector components
public StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
boolean ShowCancel,
StandardDialog.ModalityType modality)
frame - Parent frame of the Dialog BoxTitle - Title of the Dialog BoxText - Text shown in the Dialog BoxShowCancel - if true, show a "Cancel" buttonpublic StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
StandardDialog.ModalityType modality)
frame - Parent frame of the Dialog BoxTitle - Title of the Dialog BoxText - Text shown in the Dialog Boxpublic StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
java.lang.String OK,
java.lang.String Cancel,
StandardDialog.ModalityType modality)
frame - Parent frame of the Dialog BoxTitle - Title of the Dialog BoxText - Text shown in the Dialog BoxOK - String for "OK" buttonCancel - String for "Cancel" buttonpublic StringDialog(java.awt.Frame frame,
java.lang.String Title,
java.lang.String Text,
java.lang.String OK,
java.lang.String Cancel,
java.awt.Image image,
StandardDialog.ModalityType modality)
frame - Parent frame of the Dialog BoxTitle - Title of the Dialog BoxText - Text shown in the Dialog BoxOK - String for "OK" buttonCancel - String for "Cancel" buttonimage - Image to display next to textpublic StringDialog(DialogRsrc Resource, StandardDialog.ModalityType modality)
Resource - Sets resource for Dialog box.public static java.lang.String getDefaultOk()
public static java.lang.String getDefaultCancel()
public java.awt.Dimension getPreferredSize()
getPreferredSize in class java.awt.Containerprivate void create()
private javax.swing.JPanel createElementPanel()
protected void registerCallbacks()
public void setWrapLength(int wrapLength)
Set the word wrap length of the main text area in this StringDialog.
public void setFont(java.awt.Font font)
setFont in class java.awt.Containerpublic java.util.Hashtable showDialog()
Display the dialog box, locks this thread while the dialog is being displayed, and returns a hashtable of data field values when the user closes the dialog box.
Use this instead of Dialog.show(). If Hashtable returned is null, then the cancel button was clicked. Otherwise, it will contain a hash of labels(String) to results (Object).
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerprivate void loadValueHash()
private final void addRow(javax.swing.JPanel parent,
javax.swing.JComponent comp,
java.lang.String label,
int row)
public void windowActivated(java.awt.event.WindowEvent event)
windowActivated in interface java.awt.event.WindowListenerpublic void windowClosed(java.awt.event.WindowEvent event)
windowClosed in interface java.awt.event.WindowListenerpublic void windowClosing(java.awt.event.WindowEvent event)
windowClosing in interface java.awt.event.WindowListenerpublic void windowDeactivated(java.awt.event.WindowEvent event)
windowDeactivated in interface java.awt.event.WindowListenerpublic void windowDeiconified(java.awt.event.WindowEvent event)
windowDeiconified in interface java.awt.event.WindowListenerpublic void windowIconified(java.awt.event.WindowEvent event)
windowIconified in interface java.awt.event.WindowListenerpublic void windowOpened(java.awt.event.WindowEvent event)
windowOpened in interface java.awt.event.WindowListener