public class IOPSingleSelect
extends javax.swing.JDialog
implements javax.swing.event.ListSelectionListener
Collection
or an array of objects. Though they may also be added individually.
The closures are added on a per item basis
using the addAction
method.
A simple example of its usage is:
(let ((view (object ("g2d.swing.IOPView"))) (frame (object ("g2d.swing.IOPFrame" "The IOPSingleSelect Example" view))) (action (lambda (item) (lambda (self e) (invoke java.lang.System.err "println" (concat item " was chosen!"))))) (clicked (lambda (self event) (let ((iopdialog (object ("g2d.swing.IOPSingleSelect" frame "title" "text")))) (seq (invoke iopdialog "addAction" "item1" (apply action "item1")) (invoke iopdialog "addAction" "item2" (apply action "item2")) (invoke iopdialog "addAction" "item3" (apply action "item3")) (invoke iopdialog "show") ))))) (seq (invoke view "setMouseAction" java.awt.event.MouseEvent.MOUSE_CLICKED clicked) (invoke view "repaint") (invoke frame "setVisible" (boolean true))))
javax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
IOPSingleSelect(java.awt.Frame parent,
java.util.Collection<?> items,
java.lang.String title,
java.lang.String labelText)
Constructor creates the dialog, whose elements are intitally those
elements of the items collection that are Strings.
|
IOPSingleSelect(java.awt.Frame parent,
java.lang.Object[] items,
java.lang.String title,
java.lang.String labelText)
Constructor creates the dialog, whose elements are initially those
elements of the items array that are Strings.
|
IOPSingleSelect(java.awt.Frame parent,
java.lang.String title,
java.lang.String labelText)
Constructor creates the dialog, with an initially empty list of items.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(java.lang.String[] labels,
java.lang.Object[] data,
Closure closure) |
void |
addAction(java.lang.String item,
Closure action)
Adds an associated action to an item in this dialog's list.
|
void |
addButton(javax.swing.JButton button)
Adds a button to the dialog.
|
void |
setPersistAfterSelection(boolean b)
Sets the dialog's persistAfterSelection flag.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
The necessary method for the
ListSelectionListener interface. |
addImpl, 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, update
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
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, 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
add, 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, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusUpCycle
public IOPSingleSelect(java.awt.Frame parent, java.lang.String title, java.lang.String labelText)
parent
- is used to cache a pointer to the calling
window. This dialog is also popped up relative to this parent.title
- is the title that appears in the dialog frame.labelText
- is a prompt string that appears in the dialog
directly about the list of possible items.public IOPSingleSelect(java.awt.Frame parent, java.util.Collection<?> items, java.lang.String title, java.lang.String labelText)
parent
- is used to cache a pointer to the calling
window. This dialog is also popped up relative to this parent.items
- is the collection of items to appear in the popup.title
- is the title that appears in the dialog frame.labelText
- is a prompt string that appears in the dialog
directly about the list of possible items.public IOPSingleSelect(java.awt.Frame parent, java.lang.Object[] items, java.lang.String title, java.lang.String labelText)
parent
- is used to cache a pointer to the calling
window. This dialog is also popped up relative to this parent.items
- is the array of items to appear in the popup.title
- is the title that appears in the dialog frame.labelText
- is a prompt string that appears in the dialog
directly about the list of possible items.public void addAction(java.lang.String item, Closure action)
item
- the item string, if the item is not already an element of
the list, then it is added at the end.action
- the closure representing the action. It should have
arity 2. It is this closure that will be applied when the
item is selected. The first argument will be the this
pointer of this dialog.
The second argument will be the selection event.public void addAction(java.lang.String[] labels, java.lang.Object[] data, Closure closure)
public void addButton(javax.swing.JButton button)
button
- the button to add to the fraypublic void setPersistAfterSelection(boolean b)
b
- the boolean value desired.public void valueChanged(javax.swing.event.ListSelectionEvent e)
ListSelectionListener
interface.valueChanged
in interface javax.swing.event.ListSelectionListener