public class CheckOff
extends javax.swing.JOptionPane
Modifier and Type | Class and Description |
---|---|
protected class |
CheckOff.CheckOffUI
Tweaks to JOptionPane.
|
javax.swing.JOptionPane.AccessibleJOptionPane
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CANCEL_VALUE |
static java.lang.String |
CLOSED_VALUE |
protected CheckOff.CheckOffUI |
coui |
protected javax.swing.JDialog |
dialog |
static int |
FAILURE_VALUE |
static java.nio.file.FileSystem |
fileSys |
static java.lang.String |
NO_VALUE |
static java.lang.String |
NULL_VALUE |
static java.lang.String |
OK_VALUE |
protected java.awt.Component |
parent |
protected javax.swing.event.DocumentListener |
writeInEar |
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, icon, ICON_PROPERTY, INFORMATION_MESSAGE, INITIAL_SELECTION_VALUE_PROPERTY, INITIAL_VALUE_PROPERTY, initialSelectionValue, initialValue, INPUT_VALUE_PROPERTY, inputValue, message, MESSAGE_PROPERTY, MESSAGE_TYPE_PROPERTY, messageType, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, OPTION_TYPE_PROPERTY, options, OPTIONS_PROPERTY, optionType, PLAIN_MESSAGE, QUESTION_MESSAGE, SELECTION_VALUES_PROPERTY, selectionValues, UNINITIALIZED_VALUE, value, VALUE_PROPERTY, WANTS_INPUT_PROPERTY, wantsInput, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
CheckOff(java.awt.Component pa,
java.lang.String ttl,
java.lang.String query)
Construct and initialize a CheckOff chooser
|
Modifier and Type | Method and Description |
---|---|
boolean |
ask()
Pops up the option pane dialog and returns success or failure.
|
protected javax.swing.JScrollPane |
buildScrolledList() |
javax.swing.JDialog |
createDialog()
Create and fetch the JDialog slated to present the list.
|
javax.swing.JCheckBox[] |
getCheckBoxes()
Returns the array of checkboxes, one for each element of getList()
and one more if isAllowWriteIn() is true.
|
File[] |
getCheckedFiles()
Report the selected objects as a File[].
|
java.lang.Object[] |
getCheckedObjects()
Report the list items that had checkmarks.
|
java.lang.String[] |
getCheckedStrings()
Report an array of the Strings checked.
|
java.lang.Object[] |
getList() |
java.lang.Object |
getMessage() |
javax.swing.JComponent |
getQueryField() |
java.lang.String |
getTitle() |
java.lang.Object |
getValue()
Return an Object representing the button the user clicked.
|
int |
getValueIndex()
Return an int value indicating which button was clicked.
|
java.lang.String |
getWriteIn() |
boolean |
isAllowWriteIn() |
boolean |
isModal()
Report whether the dialog will be modal.
|
boolean |
isMultiSelect() |
boolean |
isWrittenIn()
Report whether the user has entered a writein value.
|
protected void |
listenToWriteIn(javax.swing.JCheckBox cBox) |
static java.lang.String |
makeString(java.lang.Object o)
Convert an object to a string.
|
void |
setAllowWriteIn(boolean allowWriteIn) |
void |
setCheckMarks(java.lang.Object[] list)
Set initially some or all of the checkmarks.
|
void |
setList(File dir)
Set the checklist with an array of the file names in directory dir.
|
void |
setList(File dir,
FileFilter fFilter)
Set the checkoff list to be those children of dir
that satisfy a FileFilter.
|
void |
setList(File dir,
java.lang.String globorregex)
Set the checkoff list to those files in a directory,
that satisfy a PathMatcher.
|
void |
setList(java.lang.Object[] objectList) |
void |
setList(java.lang.String csl)
Set the checkoff list from a comma-separated list.
|
void |
setMessage(java.lang.Object newMessage)
Ignore (Sets the option pane's message-object.)
|
void |
setModal(boolean modal)
Set the modality of the window.
|
void |
setMultiSelect(boolean multiSelect) |
void |
setOptions(java.lang.Object[] opts)
Sets the list of options to be offered to the user.
|
void |
setQueryField(javax.swing.JComponent queryField) |
void |
setQueryField(java.lang.String query) |
void |
setSortedList(java.lang.Object[] list)
Set the list to be a sorted list of objects.
|
void |
setSortedList(java.lang.Object[] list,
java.util.Comparator<java.lang.Object> comparr)
Set the list to be a sorted list of objects.
|
void |
setTitle(java.lang.String title) |
void |
setUI(javax.swing.plaf.OptionPaneUI ui)
Ignore (Sets the UI object which implements the L&F for this component.)
|
void |
setWriteIn(java.lang.String writeInValue)
Set the initial value for the "write-in" field.
|
protected boolean |
startList(File dir)
Take steps to start a new file list.
|
createDialog, createDialog, createInternalFrame, getAccessibleContext, getDesktopPaneForComponent, getFrameForComponent, getIcon, getInitialSelectionValue, getInitialValue, getInputValue, getMaxCharactersPerLineCount, getMessageType, getOptions, getOptionType, getRootFrame, getSelectionValues, getUI, getUIClassID, getWantsInput, paramString, selectInitialValue, setIcon, setInitialSelectionValue, setInitialValue, setInputValue, setMessageType, setOptionType, setRootFrame, setSelectionValues, setValue, setWantsInput, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalInputDialog, showInternalInputDialog, showInternalInputDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalOptionDialog, showMessageDialog, showMessageDialog, showMessageDialog, showOptionDialog, 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, getMaximumSize, 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, 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
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 java.lang.String OK_VALUE
public static final java.lang.String NO_VALUE
public static final java.lang.String CANCEL_VALUE
public static final java.lang.String CLOSED_VALUE
public static final java.lang.String NULL_VALUE
public static final int FAILURE_VALUE
protected java.awt.Component parent
protected CheckOff.CheckOffUI coui
protected javax.swing.JDialog dialog
protected javax.swing.event.DocumentListener writeInEar
public static final java.nio.file.FileSystem fileSys
public CheckOff(java.awt.Component pa, java.lang.String ttl, java.lang.String query)
pa
- Component over which to show the popup.
If null, the dialog is popped in the middle of the screen.ttl
- - Text for the titlebar of the popped up window.query
- The query text to place atop the list.
(The query may be expressed as a JComponent)public static java.lang.String makeString(java.lang.Object o)
o
- The Object to be String-ifiedprotected javax.swing.JScrollPane buildScrolledList()
public void setOptions(java.lang.Object[] opts)
setOptions
in class javax.swing.JOptionPane
opts
- An array of buttons to display at bottom of dialog.
If an element is a string a button is created;
otherwise the Object must be a JComponent and it is displayed.protected void listenToWriteIn(javax.swing.JCheckBox cBox)
public javax.swing.JDialog createDialog()
public boolean ask()
public java.lang.Object getMessage()
getMessage
in class javax.swing.JOptionPane
public void setUI(javax.swing.plaf.OptionPaneUI ui)
setUI
in class javax.swing.JOptionPane
public void setMessage(java.lang.Object newMessage)
setMessage
in class javax.swing.JOptionPane
public javax.swing.JComponent getQueryField()
public void setQueryField(javax.swing.JComponent queryField)
queryField
- A JTextArea to be shown atop the list of checkboxes.
For standard appearance, use setQueryField(java.lang.String)
public void setQueryField(java.lang.String query)
query
- A String to be inserted in a JTextArea
atop the check boxes.public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- the title to setpublic boolean isMultiSelect()
public void setMultiSelect(boolean multiSelect)
multiSelect
- the multiSelect to setpublic boolean isWrittenIn()
public java.lang.String getWriteIn()
public void setWriteIn(java.lang.String writeInValue)
writeInValue
- the initial value to setpublic boolean isAllowWriteIn()
public void setAllowWriteIn(boolean allowWriteIn)
allowWriteIn
- the allowWriteIn to setpublic boolean isModal()
public void setModal(boolean modal)
createDialog()
.modal
- false to produce a modeless dialog, that is, one that
blocks no other window.public java.lang.Object getValue()
getValue
in class javax.swing.JOptionPane
public int getValueIndex()
public java.lang.Object[] getList()
public void setList(java.lang.Object[] objectList)
objectList
- An array of objects, each to have a checkbox.public void setList(java.lang.String csl)
csl
- A single String that contains a comma-separated
sequence of option strings.protected boolean startList(File dir)
dir
- Proposed directorypublic void setList(File dir, FileFilter fFilter)
dir
- A File that satisfies isDirectory and isAbsolutefFilter
- A FileFilter to accept files.public void setList(File dir, java.lang.String globorregex)
dir
- A File that satisfies isDirectory and isAbsolutegloborregex
- Pattern as defined by
FileSystem.getPathMatcher(java.lang.String)
(For **, see http://stackoverflow.com/a/14164134)
If globorregex does not begin with either glob: or regex:, it is assumed to be a glob:public void setList(File dir)
dir
- A File satisfying isDirectory() and isAbsolute().public void setSortedList(java.lang.Object[] list)
list
- The List to be sortedpublic void setSortedList(java.lang.Object[] list, java.util.Comparator<java.lang.Object> comparr)
list
- Array of objects to be the options.comparr
- A Comparator applicable to the elements of the list.public java.lang.Object[] getCheckedObjects()
public File[] getCheckedFiles()
public void setCheckMarks(java.lang.Object[] list)
list
- Array of the Objects corresponding to boxes to be initially checked.public javax.swing.JCheckBox[] getCheckBoxes()
public java.lang.String[] getCheckedStrings()