public class Query
extends javax.swing.JPanel
query = new Query(); getContentPane().add(query); String[] options = {"water", "soda", "juice", "none"}; query.addRadioButtons("radio", "Radio buttons", options, "water");
Modifier and Type | Class and Description |
---|---|
static class |
Query.QueryActionListener
Listener for "line" and radio button entries.
|
static class |
Query.QueryColorChooser
Panel containing an entry box and button that opens a color chooser.
|
class |
Query.QueryFileChooser
Panel containing an entry box and file chooser.
|
static class |
Query.QueryFocusListener
Listener for line entries, for when they lose the focus.
|
static class |
Query.QueryItemListener
Listener for "CheckBox" and "Choice" entries.
|
(package private) static class |
Query.QueryScrollPane
Inner class to tie textArea to scroll pane.
|
static class |
Query.SliderListener
Listener for changes in slider.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
_background
The background color as set by setBackground().
|
protected java.awt.GridBagConstraints |
_constraints
Standard constraints for use with _grid.
|
protected java.util.Map |
_entries
The hashtable of items in the query.
|
protected java.awt.GridBagLayout |
_grid
Layout control.
|
protected java.util.Vector |
_listeners
List of registered listeners.
|
static int |
DEFAULT_ENTRY_HEIGHT
The default height of entries created with addText().
|
static int |
DEFAULT_ENTRY_WIDTH
The default width of entries created with addLine().
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
Query()
Construct a panel with no entries in it.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addPair(java.lang.String name,
javax.swing.JLabel label,
java.awt.Component widget,
java.lang.Object entry)
Add a label and a widget to the panel.
|
protected javax.swing.JLabel |
_constructLabel(java.lang.String label)
Construct a lable.
|
(package private) void |
_notifyListeners(java.lang.String name)
Notify all registered listeners that something changed for the
specified entry, if it indeed has changed.
|
protected void |
_recalculatePreferredSize(java.awt.Component widget)
Recalculate the preferred size of the entry panel.
|
protected static void |
_textAreaSetRowsAndRepackParent(javax.swing.JTextArea textArea,
int minimumNumberOfRows)
Resize the textArea and repack the containing ComponentDialog.
|
javax.swing.JCheckBox |
addCheckBox(java.lang.String name,
java.lang.String label,
boolean defaultValue)
Create an on-off check box.
|
javax.swing.JComboBox |
addChoice(java.lang.String name,
java.lang.String label,
java.lang.Object[] values,
java.lang.Object defaultChoice)
Create an uneditable choice menu.
|
javax.swing.JComboBox |
addChoice(java.lang.String name,
java.lang.String label,
java.lang.Object[] values,
java.lang.Object defaultChoice,
boolean editable)
Create a choice menu.
|
javax.swing.JComboBox |
addChoice(java.lang.String name,
java.lang.String label,
java.lang.Object[] values,
java.lang.Object defaultChoice,
boolean editable,
java.awt.Color background,
java.awt.Color foreground)
Create a choice menu.
|
Query.QueryColorChooser |
addColorChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultColor)
Create a ColorChooser.
|
javax.swing.JTextArea |
addDisplay(java.lang.String name,
java.lang.String label,
java.lang.String theValue)
Create a simple one-line text display, a non-editable value that
is set externally using the setDisplay() method.
|
javax.swing.JTextArea |
addDisplay(java.lang.String name,
java.lang.String label,
java.lang.String theValue,
java.awt.Color background,
java.awt.Color foreground)
Create a simple one-line text display, a non-editable value that
is set externally using the setDisplay() method.
|
void |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory)
Create a FileChooser that selects files only, not directories, and
has the default colors (white in the background, black in the
foreground).
|
void |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
boolean save)
Create a FileChooser that selects files only, not directories, and
has the default colors (white in the background, black in the
foreground).
|
void |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
boolean allowFiles,
boolean allowDirectories)
Create a FileChooser with default colors (white in the foreground,
black in the background).
|
Query.QueryFileChooser |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
boolean allowFiles,
boolean allowDirectories,
boolean save,
java.awt.Color background,
java.awt.Color foreground)
Create a FileChooser.
|
Query.QueryFileChooser |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
boolean allowFiles,
boolean allowDirectories,
boolean save,
java.awt.Color background,
java.awt.Color foreground,
java.io.FilenameFilter filter)
Create a FileChooser.
|
Query.QueryFileChooser |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
boolean allowFiles,
boolean allowDirectories,
java.awt.Color background,
java.awt.Color foreground)
Create a FileChooser.
|
void |
addFileChooser(java.lang.String name,
java.lang.String label,
java.lang.String defaultName,
java.net.URI base,
java.io.File startingDirectory,
java.awt.Color background,
java.awt.Color foreground)
Create a FileChooser that selects files only, not directories.
|
void |
addLine(java.lang.String name,
java.lang.String label,
java.lang.String defaultValue)
Create a single-line entry box with the specified name, label, and
default value.
|
void |
addLine(java.lang.String name,
java.lang.String label,
java.lang.String defaultValue,
java.awt.Color background,
java.awt.Color foreground)
Create a single-line entry box with the specified name, label,
default value, and background color.
|
javax.swing.JPasswordField |
addPassword(java.lang.String name,
java.lang.String label,
java.lang.String defaultValue)
Create a single-line password box with the specified name, label, and
default value.
|
javax.swing.JPasswordField |
addPassword(java.lang.String name,
java.lang.String label,
java.lang.String defaultValue,
java.awt.Color background,
java.awt.Color foreground)
Create a single-line password box with the specified name,
label, and default value.
|
void |
addQueryListener(QueryListener listener)
Add a listener.
|
void |
addRadioButtons(java.lang.String name,
java.lang.String label,
java.lang.String[] values,
java.lang.String defaultValue)
Create a bank of radio buttons.
|
void |
addSelectButtons(java.lang.String name,
java.lang.String label,
java.lang.String[] values,
java.util.Set initiallySelected)
Create a bank of buttons that provides a list of
choices, any subset of which may be chosen at a time.
|
void |
addSeparator()
Create a horizontal separator between components.
|
javax.swing.JSlider |
addSlider(java.lang.String name,
java.lang.String label,
int defaultValue,
int minimum,
int maximum)
Create a slider with the specified name, label, default
value, maximum, and minimum.
|
javax.swing.JSlider |
addSlider(java.lang.String name,
java.lang.String label,
int defaultValue,
int minimum,
int maximum,
java.lang.String minLabelText,
java.lang.String maxLabelText)
Create a slider with the specified name, label, default value,
maximum, minimum, and label texts for the maximum and minimum
slider positions.
|
void |
addText(java.lang.String text,
java.awt.Color color,
int alignment)
Add text to the query.
|
void |
addTextArea(java.lang.String name,
java.lang.String label,
java.lang.String theValue)
Create a text area.
|
void |
addTextArea(java.lang.String name,
java.lang.String label,
java.lang.String theValue,
java.awt.Color background,
java.awt.Color foreground)
Create a text area.
|
javax.swing.JTextArea |
addTextArea(java.lang.String name,
java.lang.String label,
java.lang.String theValue,
java.awt.Color background,
java.awt.Color foreground,
int height,
int width)
Create a text area with the specified height and width (in
characters).
|
boolean |
booleanValue(java.lang.String name)
Deprecated.
Use getBooleanValue(String name) instead.
|
double |
doubleValue(java.lang.String name)
Deprecated.
Use getDoubleValue(String name) instead.
|
boolean |
getBooleanValue(java.lang.String name)
Get the current value in the entry with the given name
and return as a boolean.
|
char[] |
getCharArrayValue(java.lang.String name)
Get the current value in the entry with the given name
and return as an array of characters.
|
double |
getDoubleValue(java.lang.String name)
Get the current value in the entry with the given name
and return as a double value.
|
int |
getIntValue(java.lang.String name)
Get the current value in the entry with the given name
and return as an integer.
|
java.awt.Dimension |
getMaximumSize()
Return the preferred height, but set the width to the maximum
possible value.
|
java.lang.Object |
getObjectValue(java.lang.String name)
Get the current value in the entry with the given name,
and return as an Object.
|
java.lang.String |
getStringValue(java.lang.String name)
Get the current value in the entry with the given name,
and return as a String.
|
int |
getTextHeight()
Get the preferred number of lines to be used for entry boxes created
in using addTextArea().
|
int |
getTextWidth()
Get the preferred width in characters to be used for entry
boxes created in using addLine().
|
boolean |
hasEntry(java.lang.String name)
Return whether an entry exists with the specified name.
|
int |
intValue(java.lang.String name)
Deprecated.
Use getIntValue(String name) instead.
|
void |
notifyListeners()
Notify listeners of the current value of all entries, unless
those entries have not changed since the last notification.
|
void |
removeQueryListener(QueryListener listener)
Remove a listener.
|
void |
set(java.lang.String name,
java.lang.String value)
Set the value in the entry with the given name.
|
void |
setAndNotify(java.lang.String name,
java.lang.String value)
Set the value in the entry with the given name and notify listeners.
|
void |
setBackground(java.awt.Color color)
Set the background color for all the widgets.
|
void |
setBoolean(java.lang.String name,
boolean value)
Set the current value in the entry with the given name.
|
void |
setColumns(int columns)
Specify the number of columns to use.
|
void |
setDisplay(java.lang.String name,
java.lang.String value)
Set the displayed text of an entry that has been added using
addDisplay.
|
void |
setEnabled(java.lang.String name,
boolean value)
For line, display, check box, slider, radio button, or choice
entries made, if the second argument is false, then it will
be disabled.
|
void |
setInsets(java.awt.Insets insets)
Set the insets for the GridBagLayout manager used to layout the
components.
|
void |
setLine(java.lang.String name,
java.lang.String value)
Set the displayed text of an item that has been added using
addLine.
|
void |
setMessage(java.lang.String message)
Specify a message to be displayed above the query.
|
void |
setSlider(java.lang.String name,
int value)
Set the position of an item that has been added using
addSlider.
|
void |
setTextHeight(int characters)
Specify the preferred height to be used for entry boxes created
in using addTextArea().
|
void |
setTextWidth(int characters)
Specify the preferred width to be used for entry boxes created
in using addLine().
|
void |
setToolTip(java.lang.String name,
java.lang.String tip)
Specify a tool tip to appear when the mouse lingers over the label.
|
static java.awt.Color |
stringToColor(java.lang.String description)
Convert the specified string to a color.
|
java.lang.String |
stringValue(java.lang.String name)
Deprecated.
Use getStringValue(String name) instead.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final int DEFAULT_ENTRY_HEIGHT
public static final int DEFAULT_ENTRY_WIDTH
protected java.awt.Color _background
protected java.awt.GridBagConstraints _constraints
protected java.util.Map _entries
protected java.awt.GridBagLayout _grid
protected java.util.Vector _listeners
public javax.swing.JCheckBox addCheckBox(java.lang.String name, java.lang.String label, boolean defaultValue)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultValue
- The default value (true for on).public javax.swing.JComboBox addChoice(java.lang.String name, java.lang.String label, java.lang.Object[] values, java.lang.Object defaultChoice)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.values
- The list of possible choices.defaultChoice
- Default choice.public javax.swing.JComboBox addChoice(java.lang.String name, java.lang.String label, java.lang.Object[] values, java.lang.Object defaultChoice, boolean editable)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.values
- The list of possible choices.defaultChoice
- Default choice.editable
- True if an arbitrary choice can be entered, in addition
to the choices in values.public javax.swing.JComboBox addChoice(java.lang.String name, java.lang.String label, java.lang.Object[] values, java.lang.Object defaultChoice, boolean editable, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.values
- The list of possible choices.defaultChoice
- Default choice.editable
- True if an arbitrary choice can be entered, in addition
to the choices in values.background
- The background color for the editable part.foreground
- The foreground color for the editable part.public Query.QueryColorChooser addColorChooser(java.lang.String name, java.lang.String label, java.lang.String defaultColor)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultColor
- The default color to use.public javax.swing.JTextArea addDisplay(java.lang.String name, java.lang.String label, java.lang.String theValue)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.theValue
- Default string to display.public javax.swing.JTextArea addDisplay(java.lang.String name, java.lang.String label, java.lang.String theValue, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.theValue
- Default string to display.background
- The background color, or null to use defaults.foreground
- The foreground color, or null to use defaults.public void addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.public void addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, boolean save)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.save
- Whether the file is to be saved or opened.public void addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, boolean allowFiles, boolean allowDirectories)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.allowFiles
- True if regular files may be chosen.allowDirectories
- True if directories may be chosen.public void addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.background
- The background color for the text entry box.foreground
- The foreground color for the text entry box.public Query.QueryFileChooser addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, boolean allowFiles, boolean allowDirectories, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.allowFiles
- True if regular files may be chosen.allowDirectories
- True if directories may be chosen.background
- The background color for the text entry box.foreground
- The foreground color for the text entry box.public Query.QueryFileChooser addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, boolean allowFiles, boolean allowDirectories, boolean save, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.allowFiles
- True if regular files may be chosen.allowDirectories
- True if directories may be chosen.save
- Whether the file is to be saved or opened.background
- The background color for the text entry box.foreground
- The foreground color for the text entry box.public Query.QueryFileChooser addFileChooser(java.lang.String name, java.lang.String label, java.lang.String defaultName, java.net.URI base, java.io.File startingDirectory, boolean allowFiles, boolean allowDirectories, boolean save, java.awt.Color background, java.awt.Color foreground, java.io.FilenameFilter filter)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.defaultName
- The default file name to use.base
- The URI with respect to which to give
relative file names, or null to give absolute file name.startingDirectory
- The directory to open the file chooser in.allowFiles
- True if regular files may be chosen.allowDirectories
- True if directories may be chosen.save
- Whether the file is to be saved or opened.background
- The background color for the text entry box.foreground
- The foreground color for the text entry box.filter
- A filename filter, or null to not have one.public void addLine(java.lang.String name, java.lang.String label, java.lang.String defaultValue)
name
- The name used to identify the entry (when accessing
the entry).label
- The label to attach to the entry.defaultValue
- Default value to appear in the entry box.public void addLine(java.lang.String name, java.lang.String label, java.lang.String defaultValue, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when accessing
the entry).label
- The label to attach to the entry.defaultValue
- Default value to appear in the entry box.background
- The background color.foreground
- The foreground color.public javax.swing.JPasswordField addPassword(java.lang.String name, java.lang.String label, java.lang.String defaultValue)
name
- The name used to identify the entry (when accessing
the entry).label
- The label to attach to the entry.defaultValue
- Default value to appear in the entry box.public javax.swing.JPasswordField addPassword(java.lang.String name, java.lang.String label, java.lang.String defaultValue, java.awt.Color background, java.awt.Color foreground)
The underlying class that is used to implement the password facility is javax.swing.JPasswordField. For details about how to use JPasswordField, see the Java Tutorial
name
- The name used to identify the entry (when accessing
the entry).label
- The label to attach to the entry.defaultValue
- Default value to appear in the entry box.background
- The background color.foreground
- The foreground color.public void addQueryListener(QueryListener listener)
listener
- The listener to add.removeQueryListener(QueryListener)
public void addRadioButtons(java.lang.String name, java.lang.String label, java.lang.String[] values, java.lang.String defaultValue)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.values
- The list of possible choices.defaultValue
- Default value.public void addSelectButtons(java.lang.String name, java.lang.String label, java.lang.String[] values, java.util.Set initiallySelected)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.values
- The list of possible choices.initiallySelected
- The initially selected choices, or null
to indicate that none are selected.public void addSeparator()
public javax.swing.JSlider addSlider(java.lang.String name, java.lang.String label, int defaultValue, int minimum, int maximum) throws java.lang.IllegalArgumentException
name
- The name used to identify the slider.label
- The label to attach to the slider.defaultValue
- Initial position of slider.maximum
- Maximum value of slider.minimum
- Minimum value of slider.java.lang.IllegalArgumentException
- If the desired default value
is not between the minimum and maximum.public javax.swing.JSlider addSlider(java.lang.String name, java.lang.String label, int defaultValue, int minimum, int maximum, java.lang.String minLabelText, java.lang.String maxLabelText) throws java.lang.IllegalArgumentException
name
- The name used to identify the slider.label
- The label to attach to the slider.defaultValue
- Initial position of slider.maximum
- Maximum value of slider.minimum
- Minimum value of slider.minLabelText
- Text to be displayed at the slider's minimum
setting. Set to null
or the empty
String to hide the minimum label.maxLabelText
- Text to be displayed at the slider's maximum
setting. Set to null
or the empty
String to hide the maximum label.java.lang.IllegalArgumentException
- If the desired default value
is not between the minimum and maximum.public void addText(java.lang.String text, java.awt.Color color, int alignment)
text
- The text to be added.color
- The color of the text to be added.alignment
- The alignment, which is a value suitable
for the JPanel() constructor.public void addTextArea(java.lang.String name, java.lang.String label, java.lang.String theValue)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.theValue
- The value of this text areapublic void addTextArea(java.lang.String name, java.lang.String label, java.lang.String theValue, java.awt.Color background, java.awt.Color foreground)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.theValue
- The value of this text area.background
- The background color.foreground
- The foreground color.public javax.swing.JTextArea addTextArea(java.lang.String name, java.lang.String label, java.lang.String theValue, java.awt.Color background, java.awt.Color foreground, int height, int width)
name
- The name used to identify the entry (when calling get).label
- The label to attach to the entry.theValue
- The value of this text area.background
- The background color.foreground
- The foreground color.height
- The height.width
- The width.@Deprecated public boolean booleanValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
checkbox. This is a runtime exception, so it
need not be declared explicitly.@Deprecated public double doubleValue(java.lang.String name) throws java.lang.IllegalArgumentException, java.util.NoSuchElementException, java.lang.NumberFormatException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.NumberFormatException
- If the value of the entry cannot
be converted to a double. This is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
line. This is a runtime exception, so it
need not be declared explicitly.public boolean getBooleanValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
checkbox. This is a runtime exception, so it
need not be declared explicitly.public char[] getCharArrayValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
If the entry is a password field, then it is recommended for strong security that each element of the array be set to 0 after use.
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry type does not
have a string representation (this should not be thrown).
This is a runtime exception, so it need not be declared explicitly.public double getDoubleValue(java.lang.String name) throws java.lang.IllegalArgumentException, java.util.NoSuchElementException, java.lang.NumberFormatException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.NumberFormatException
- If the value of the entry cannot
be converted to a double. This is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
line. This is a runtime exception, so it
need not be declared explicitly.public int getIntValue(java.lang.String name) throws java.lang.IllegalArgumentException, java.util.NoSuchElementException, java.lang.NumberFormatException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.NumberFormatException
- If the value of the entry cannot
be converted to an integer. This is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
choice, line, or slider. This is a runtime exception, so it
need not be declared explicitly.public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
public java.lang.Object getObjectValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
getStringValue(String)
in that if the entry is a combo box, the
selected object is returned, which need not be a string.
All entry types support this.
Note that this method should be called from the event dispatch
thread, since it needs to query to UI widgets for their current
values. If it is called from another thread, there is no
assurance that the value returned will be the current value.name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry type does not
have a string representation (this should not be thrown).public java.lang.String getStringValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry type does not
have a string representation (this should not be thrown).public int getTextHeight()
addTextArea(String, String, String)
,
setTextHeight(int)
public int getTextWidth()
setTextWidth(int)
public boolean hasEntry(java.lang.String name)
name
- The name.@Deprecated public int intValue(java.lang.String name) throws java.lang.IllegalArgumentException, java.util.NoSuchElementException, java.lang.NumberFormatException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.NumberFormatException
- If the value of the entry cannot
be converted to an integer. This is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
choice, line, or slider. This is a runtime exception, so it
need not be declared explicitly.public void notifyListeners()
public void removeQueryListener(QueryListener listener)
listener
- The listener to remove.addQueryListener(QueryListener)
public void set(java.lang.String name, java.lang.String value) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name used to identify the entry (when calling get).value
- The value to set the entry to.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the value does not parse
to the appropriate type.public void setAndNotify(java.lang.String name, java.lang.String value) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name used to identify the entry (when calling get).value
- The value to set the entry to.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the value does not parse
to the appropriate type.public void setBackground(java.awt.Color color)
setBackground
in class javax.swing.JComponent
color
- The background color.public void setBoolean(java.lang.String name, boolean value) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.value
- The new value of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
checkbox. This is a runtime exception, so it
need not be declared explicitly.public void setColumns(int columns)
columns
- The number of columns.public void setDisplay(java.lang.String name, java.lang.String value) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.value
- The string to display.java.util.NoSuchElementException
- If there is no entry with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
display. This is a runtime exception, so it
need not be declared explicitly.public void setEnabled(java.lang.String name, boolean value)
name
- The name of the entry.value
- If false, disables the entry.public void setInsets(java.awt.Insets insets)
insets
- The insets.public void setLine(java.lang.String name, java.lang.String value)
name
- The name of the entry.value
- The string to display.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
display. This is a runtime exception, so it
need not be declared explicitly.public void setMessage(java.lang.String message)
message
- The message to display.public void setSlider(java.lang.String name, int value)
name
- The name of the entry.value
- The value to set the slider position.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry is not a
slider. This is a runtime exception, so it
need not be declared explicitly.public void setTextHeight(int characters)
characters
- The preferred height.addTextArea(String, String, String)
,
getTextHeight()
public void setTextWidth(int characters)
characters
- The preferred width.getTextWidth()
public void setToolTip(java.lang.String name, java.lang.String tip)
name
- The name of the entry.tip
- The text of the tool tip.public static java.awt.Color stringToColor(java.lang.String description)
description
- The description of the color, or white
if any parse error occurs.@Deprecated public java.lang.String stringValue(java.lang.String name) throws java.util.NoSuchElementException, java.lang.IllegalArgumentException
name
- The name of the entry.java.util.NoSuchElementException
- If there is no item with the
specified name. Note that this is a runtime exception, so it
need not be declared explicitly.java.lang.IllegalArgumentException
- If the entry type does not
have a string representation (this should not be thrown).protected void _addPair(java.lang.String name, javax.swing.JLabel label, java.awt.Component widget, java.lang.Object entry)
name
- The name of the entry.label
- The label.widget
- The interactive entry to the right of the label.entry
- The object that contains user data.protected javax.swing.JLabel _constructLabel(java.lang.String label)
label
- The text for the label. If the value of the label
argument is non-empty, then ": " is appended.protected void _recalculatePreferredSize(java.awt.Component widget)
widget
- The widget added to the entry panel.protected static void _textAreaSetRowsAndRepackParent(javax.swing.JTextArea textArea, int minimumNumberOfRows)
textArea
- The text area to be have its rows set and its parent packed.minimumNumberOfRows
- If the text area has less than this
number of rows, then one row is added and the parent
ComponentDialog of the text area is repacked.void _notifyListeners(java.lang.String name)
name
- The entry that may have changed.