public class JSheet
extends javax.swing.JDialog
A JSheet blocks input on its owner window, while it is visible.
Unlike application modal dialogs, the show method of a JSheet does return immediately, when the JSheet has become visible. Applications need to use a SheetListener to get the return value of a JSheet.
Requires Java 1.4.
Caveats: We are using an unsupported API call to make the JSheet translucent. This API may go away in future versions of the Macintosh Runtime for Java. In such a case, we (hopefully) just end up with a non-opaque sheet.
javax.swing.JDialog.AccessibleJDialogjava.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityTypejava.awt.Window.AccessibleAWTWindow, java.awt.Window.Type| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.event.EventListenerList |
listenerList
Event listener list.
|
accessibleContext, rootPane, rootPaneCheckingEnabledBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
JSheet(java.awt.Dialog owner)
Creates a new JSheet.
|
JSheet(java.awt.Frame owner)
Creates a new JSheet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotify() |
void |
addSheetListener(SheetListener l)
Adds a sheet listener.
|
void |
dispose() |
protected void |
fireOptionSelected(javax.swing.JFileChooser pane,
int option)
Notify all listeners that have registered interest for
notification on this event type.
|
protected void |
fireOptionSelected(javax.swing.JOptionPane pane)
Notify all listeners that have registered interest for
notification on this event type.
|
protected void |
fireOptionSelected(javax.swing.JOptionPane pane,
int option,
java.lang.Object value,
java.lang.Object inputValue)
Notify all listeners that have registered interest for
notification on this event type.
|
protected void |
fireOptionSelected(URIChooser pane,
int option)
Notify all listeners that have registered interest for
notification on this event type.
|
void |
hide() |
protected void |
hide0() |
protected void |
installSheet()
Installs the sheet on the owner.
|
boolean |
isAnimated()
If this returns true, the JSheet uses a transition effect when shown
and when hidden.
|
protected boolean |
isShowAsSheet() |
void |
removeSheetListener(SheetListener l)
Removes a sheet listener.
|
static void |
requestUserAttention(boolean requestCritical)
Requests attention from user.
|
void |
setAnimated(boolean newValue)
If this is set to true, the JSheet uses a transition effect when shown
and when hidden.
|
void |
show() |
protected void |
show0() |
static void |
showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
javax.swing.Icon icon,
SheetListener listener)
Brings up a sheet with a specified icon, where the number of
choices is determined by the
optionType parameter. |
static void |
showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
SheetListener listener)
Brings up a sheet where the number of choices is determined
by the
optionType parameter, where the
messageType
parameter determines the icon to display. |
static void |
showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
SheetListener listener)
Brings up a sheet where the number of choices is determined
by the
optionType parameter. |
static void |
showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
Brings up a sheet with the options Yes,
No and Cancel.
|
static void |
showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] selectionValues,
java.lang.Object initialSelectionValue,
SheetListener listener)
Prompts the user for input in a sheet where the
initial selection, possible selections, and all other options can
be specified.
|
static void |
showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
SheetListener listener)
Shows a sheet requesting input from the user parented to
parentComponent and message type messageType. |
static void |
showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.Object initialSelectionValue,
SheetListener listener)
Shows a question-message sheet requesting input from the user and
parented to
parentComponent. |
static void |
showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
Shows a question-message sheet requesting input from the user
parented to
parentComponent. |
static void |
showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message)
Brings up an information-message sheet.
|
static void |
showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType)
Brings up a sheet that displays a message using a default
icon determined by the
messageType parameter. |
static void |
showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
javax.swing.Icon icon,
SheetListener listener)
Brings up a sheet displaying a message, specifying all parameters.
|
static void |
showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
SheetListener listener)
Brings up a sheet that displays a message using a default
icon determined by the
messageType parameter. |
static void |
showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
Brings up an information-message sheet.
|
static void |
showOpenSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
SheetListener listener)
Displays an "Open File" file chooser sheet.
|
static void |
showOpenSheet(URIChooser chooser,
java.awt.Component parent,
SheetListener listener)
Displays an "Open File" file chooser sheet.
|
static void |
showOptionSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] options,
java.lang.Object initialValue,
SheetListener listener)
Brings up a sheet with a specified icon, where the initial
choice is determined by the
initialValue parameter and
the number of choices is determined by the optionType
parameter. |
static void |
showSaveSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
SheetListener listener)
Displays a "Save File" file chooser sheet.
|
static void |
showSaveSheet(URIChooser chooser,
java.awt.Component parent,
SheetListener listener)
Displays a "Save File" file chooser sheet.
|
static void |
showSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
java.lang.String approveButtonText,
SheetListener listener)
Displays a custom file chooser sheet with a custom approve button.
|
static void |
showSheet(javax.swing.JOptionPane pane,
java.awt.Component parentComponent,
SheetListener listener)
Displays an option pane as a sheet on its parent window.
|
static void |
showSheet(URIChooser chooser,
java.awt.Component parent,
java.lang.String approveButtonText,
SheetListener listener)
Displays a custom file chooser sheet with a custom approve button.
|
protected void |
uninstallSheet()
Uninstalls the sheet on the owner.
|
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, updategetModalityType, getTitle, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, toBackaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, 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, 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, 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, transferFocusUpCycleprotected javax.swing.event.EventListenerList listenerList
public JSheet(java.awt.Frame owner)
public JSheet(java.awt.Dialog owner)
protected boolean isShowAsSheet()
protected void installSheet()
protected void uninstallSheet()
public void addNotify()
addNotify in class java.awt.Dialogpublic void setAnimated(boolean newValue)
public boolean isAnimated()
public void dispose()
dispose in class java.awt.Windowprotected void hide0()
protected void show0()
public void hide()
hide in class java.awt.Dialogpublic void show()
show in class java.awt.Dialogpublic static void requestUserAttention(boolean requestCritical)
public void addSheetListener(SheetListener l)
public void removeSheetListener(SheetListener l)
protected void fireOptionSelected(javax.swing.JOptionPane pane)
protected void fireOptionSelected(javax.swing.JOptionPane pane,
int option,
java.lang.Object value,
java.lang.Object inputValue)
protected void fireOptionSelected(javax.swing.JFileChooser pane,
int option)
protected void fireOptionSelected(URIChooser pane, int option)
public static void showSheet(javax.swing.JOptionPane pane,
java.awt.Component parentComponent,
SheetListener listener)
pane - The option pane.parentComponent - The parent of the option pane.listener - The listener for SheetEvents.public static void showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
parentComponent - determines the Frame in which the
sheet is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaylistener - The listener for SheetEvents.public static void showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
SheetListener listener)
optionType parameter.parentComponent - determines the Frame in which the
sheet is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displayoptionType - an int designating the options available on the dialog:
YES_NO_OPTION, or
YES_NO_CANCEL_OPTIONlistener - The listener for SheetEvents.public static void showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
SheetListener listener)
optionType parameter, where the
messageType
parameter determines the icon to display.
The messageType parameter is primarily used to supply
a default icon from the Look and Feel.parentComponent - determines the Frame in
which the dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displayoptionType - an integer designating the options available
on the dialog: YES_NO_OPTION,
or YES_NO_CANCEL_OPTIONmessageType - an integer designating the kind of message this is;
primarily used to determine the icon from the pluggable
Look and Feel: JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGElistener - The listener for SheetEvents.public static void showConfirmSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
javax.swing.Icon icon,
SheetListener listener)
optionType parameter.
The messageType parameter is primarily used to supply
a default icon from the look and feel.parentComponent - determines the Frame in which the
dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displayoptionType - an int designating the options available on the dialog:
YES_NO_OPTION,
or YES_NO_CANCEL_OPTIONmessageType - an int designating the kind of message this is,
primarily used to determine the icon from the pluggable
Look and Feel: JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGEicon - the icon to display in the dialoglistener - The listener for SheetEvents.public static void showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
parentComponent.parentComponent - the parent Component for the
dialoglistener - The listener for SheetEvents.public static void showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
java.lang.Object initialSelectionValue,
SheetListener listener)
parentComponent. The input value will be
initialized to initialSelectionValue.parentComponent - the parent Component for the
dialogmessage - the Object to displayinitialSelectionValue - the value used to initialize the input
fieldlistener - The listener for SheetEvents.public static void showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
SheetListener listener)
parentComponent and message type messageType.parentComponent - the parent Component for the
dialogmessage - the Object to displaymessageType - the type of message that is to be displayed:
JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGElistener - The listener for SheetEvents.public static void showInputSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] selectionValues,
java.lang.Object initialSelectionValue,
SheetListener listener)
selectionValues, where null implies the
user can input
whatever they wish, usually by means of a JTextField.
initialSelectionValue is the initial value to prompt
the user with. It is up to the UI to decide how best to represent
the selectionValues, but usually a
JComboBox, JList, or
JTextField will be used.parentComponent - the parent Component for the
dialogmessage - the Object to displaymessageType - the type of message to be displayed:
JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGEicon - the Icon image to displayselectionValues - an array of Objects that
gives the possible selectionsinitialSelectionValue - the value used to initialize the input
fieldlistener - The listener for SheetEvents.public static void showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message)
parentComponent - determines the Frame in
which the dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaypublic static void showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
SheetListener listener)
parentComponent - determines the Frame in
which the dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaylistener - This listener is notified when the sheet is dismissed.public static void showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType)
messageType parameter.parentComponent - determines the Frame
in which the dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaymessageType - the type of message to be displayed:
JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGEpublic static void showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
SheetListener listener)
messageType parameter.parentComponent - determines the Frame
in which the dialog is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaymessageType - the type of message to be displayed:
JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGElistener - This listener is notified when the sheet is dismissed.public static void showMessageSheet(java.awt.Component parentComponent,
java.lang.Object message,
int messageType,
javax.swing.Icon icon,
SheetListener listener)
parentComponent - determines the Frame in which the
sheet is displayed; if null,
or if the parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displaymessageType - the type of message to be displayed:
JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGEicon - an icon to display in the sheet that helps the user
identify the kind of message that is being displayedlistener - This listener is notified when the sheet is dismissed.public static void showOptionSheet(java.awt.Component parentComponent,
java.lang.Object message,
int optionType,
int messageType,
javax.swing.Icon icon,
java.lang.Object[] options,
java.lang.Object initialValue,
SheetListener listener)
initialValue parameter and
the number of choices is determined by the optionType
parameter.
If optionType is YES_NO_OPTION,
or YES_NO_CANCEL_OPTION
and the options parameter is null,
then the options are
supplied by the look and feel.
The messageType parameter is primarily used to supply
a default icon from the look and feel.
parentComponent - determines the Frame
in which the dialog is displayed; if
null, or if the
parentComponent has no
Frame, the sheet is displayed as a dialog.message - the Object to displayoptionType - an integer designating the options available on the
dialog: YES_NO_OPTION,
or YES_NO_CANCEL_OPTIONmessageType - an integer designating the kind of message this is,
primarily used to determine the icon from the
pluggable Look and Feel: JOptionPane.ERROR_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
or JOptionPane.PLAIN_MESSAGEicon - the icon to display in the dialogoptions - an array of objects indicating the possible choices
the user can make; if the objects are components, they
are rendered properly; non-String
objects are
rendered using their toString methods;
if this parameter is null,
the options are determined by the Look and FeelinitialValue - the object that represents the default selection
for the dialog; only meaningful if options
is used; can be nulllistener - The listener for SheetEvents.public static void showSaveSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
SheetListener listener)
parent - the parent component of the dialog,
can be null.listener - The listener for SheetEvents.public static void showOpenSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
SheetListener listener)
parent - the parent component of the dialog,
can be null.listener - The listener for SheetEvents.public static void showSaveSheet(URIChooser chooser, java.awt.Component parent, SheetListener listener)
parent - the parent component of the dialog,
can be null.listener - The listener for SheetEvents.public static void showOpenSheet(URIChooser chooser, java.awt.Component parent, SheetListener listener)
parent - the parent component of the dialog,
can be null.listener - The listener for SheetEvents.public static void showSheet(javax.swing.JFileChooser chooser,
java.awt.Component parent,
java.lang.String approveButtonText,
SheetListener listener)
parent - the parent component of the dialog;
can be nullapproveButtonText - the text of the ApproveButtonlistener - The listener for SheetEvents.public static void showSheet(URIChooser chooser, java.awt.Component parent, java.lang.String approveButtonText, SheetListener listener)
parent - the parent component of the dialog;
can be nullapproveButtonText - the text of the ApproveButtonlistener - The listener for SheetEvents.