org.ceryle.ui
Class OptionPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ceryle.ui.OptionPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class OptionPanel
- extends JPanel
Extends JPanel providing a set of radio buttons for making a
multiple-option decision. The result is returned as an int (indicating
which of the options was selected) via getResult(), -1 if none
were selected or the dialog was cancelled.
The supplied options can be in one of two forms, either a List of
Strings, or a List of String[] arrays, the latter pairings where
the first String is the displayed item, the second descriptive
text that shows up in a Help box when the item is selected.
The help text area supports simple HTML 3.2-era presentational markup.
- Since:
- JDK1.3
- Version:
- $Id: OptionPanel.java,v 3.10 2007-06-15 12:09:39 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Field Summary |
static int |
panel_width
The preferred width of the panel. |
static int |
scroll_minimum
The maximum number of list items prior to using a scrolling list. |
static boolean |
useSplit
When true, the OptionPanel will use a split pane to separate Help rather
than simply a separate pre-sized panel. |
|
Constructor Summary |
OptionPanel(List options,
int defaultOption)
Constructor for a dialog box for selecting from amongst some options. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, setBackground, 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 |
| Methods inherited from class java.awt.Container |
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, transferFocusBackward, transferFocusDownCycle, 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, 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, hide, 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, transferFocusUpCycle |
useSplit
public static boolean useSplit
- When true, the OptionPanel will use a split pane to separate Help rather
than simply a separate pre-sized panel.
scroll_minimum
public static int scroll_minimum
- The maximum number of list items prior to using a scrolling list.
panel_width
public static int panel_width
- The preferred width of the panel. The default is 400.
OptionPanel
public OptionPanel(List options,
int defaultOption)
- Constructor for a dialog box for selecting from amongst some options.
The supplied options can be either be a List of Strings, a List of
String[] or Object[], the latter if the first two Objects are Strings
(any more than the first two are ignored).
- Parameters:
options - the List of Strings or a List of String[]
createSouthPanel
public void createSouthPanel(JComponent center,
String helptext)
- Builds the south panel, and adds the center panel depending on the setting of useSplit.
getButtonRegistry
public Hashtable getButtonRegistry()
- Return the number-to-button registry (Integer keys).
hasButtonEnabled
public boolean hasButtonEnabled()
- Return true if there are any enabled buttons.
isHelpVisible
public boolean isHelpVisible()
- Gets the visibility of the help panel.
setHelpVisible
public void setHelpVisible(boolean visible)
- Sets the visibility of the help panel.
setHelp
public void setHelp(String s)
- Sets the help text to the String s.
getSelected
public int getSelected()
- Returns the number of the selected option (starting at 1, not 0).
Returns -1 if no selection has been made.
setSelected
public void setSelected(JRadioButton button)
- Sets the selected option. If the original source content included
help text, this is displayed in the Help area.
setDefaultOption
public void setDefaultOption(int option)
- Sets the default option to the value of option. The value
is ignored if out of range or -1.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.