|
JHotDraw 7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.jhotdraw.gui.JSheet
public class JSheet
JSheet is a document modal dialog which is displayed below the title bar of a JFrame.
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
javax.swing.JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.event.EventListenerList |
listenerList
Event listener list. |
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JSheet(java.awt.Dialog owner)
Creates a new JSheet. |
|
JSheet(java.awt.Frame owner)
Creates a new JSheet. |
Method Summary | |
---|---|
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. |
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 |
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 |
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. |
protected void |
uninstallSheet()
Uninstalls the sheet on the owner. |
Methods inherited from class javax.swing.JDialog |
---|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Dialog |
---|
getTitle, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected javax.swing.event.EventListenerList listenerList
Constructor Detail |
---|
public JSheet(java.awt.Frame owner)
public JSheet(java.awt.Dialog owner)
Method Detail |
---|
protected boolean isShowAsSheet()
protected void installSheet()
protected void uninstallSheet()
public void addNotify()
addNotify
in class java.awt.Dialog
public void setAnimated(boolean newValue)
public boolean isAnimated()
public void dispose()
dispose
in class java.awt.Window
protected void hide0()
protected void show0()
public void hide()
hide
in class java.awt.Dialog
public void show()
show
in class java.awt.Dialog
public 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)
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_OPTION
listener
- 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_OPTION
messageType
- 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_MESSAGE
listener
- 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_OPTION
messageType
- 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_MESSAGE
icon
- 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_MESSAGE
listener
- 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_MESSAGE
icon
- the Icon
image to displayselectionValues
- an array of Object
s 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_MESSAGE
public 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_MESSAGE
listener
- 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_MESSAGE
icon
- 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_OPTION
messageType
- 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_MESSAGE
icon
- 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 null
listener
- 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 showSheet(javax.swing.JFileChooser chooser, java.awt.Component parent, java.lang.String approveButtonText, SheetListener listener)
parent
- the parent component of the dialog;
can be null
approveButtonText
- the text of the ApproveButton
listener
- The listener for SheetEvents.
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |