DialogDescriptor, NotifyDescriptor.Confirmation, NotifyDescriptor.InputLine, NotifyDescriptor.Messagepublic class NotifyDescriptor
extends java.lang.Object
Simple example of usage:
NotifyDescriptor d =
new NotifyDescriptor.Message("Hello...", NotifyDescriptor.INFORMATION_MESSAGE);
DialogDisplayer.getDefault().notify(d);
or to get a result:
NotifyDescriptor d =
new NotifyDescriptor.Confirmation("Really do this?!", "Dialog Title",
NotifyDescriptor.OK_CANCEL_OPTION);
if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) {
// really do it...
}
| Modifier and Type | Class | Description |
|---|---|---|
static class |
NotifyDescriptor.Confirmation |
Provides a description of a possible action and requests confirmation from the user before proceeding.
|
static class |
NotifyDescriptor.Exception |
Deprecated.
No longer used. Try
java.util.logging or Exceptions. |
static class |
NotifyDescriptor.InputLine |
Notification providing for a line of text input.
|
static class |
NotifyDescriptor.Message |
Provides information about the results of a command.
|
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.Object |
CANCEL_OPTION |
Return value if CANCEL is chosen.
|
static java.lang.Object |
CLOSED_OPTION |
Return value if user closes the window without pressing any button.
|
static int |
DEFAULT_OPTION |
Option type used by default.
|
static int |
ERROR_MESSAGE |
Message type for error messages.
|
static int |
INFORMATION_MESSAGE |
Message type for information messages.
|
static java.lang.Object |
NO_OPTION |
Return value if NO is chosen.
|
static int |
OK_CANCEL_OPTION |
Option type used for cancellable confirmations.
|
static java.lang.Object |
OK_OPTION |
Return value if OK is chosen.
|
static int |
PLAIN_MESSAGE |
Plain message type using no icon.
|
static java.lang.String |
PROP_DETAIL |
Name of property for the detail message reported.
|
static java.lang.String |
PROP_ERROR_NOTIFICATION |
Name of property for the error message at the bottom of the wizard.
|
static java.lang.String |
PROP_INFO_NOTIFICATION |
Name of property for the error message at the bottom of the wizard.
|
static java.lang.String |
PROP_MESSAGE |
Name of property for the message to be displayed.
|
static java.lang.String |
PROP_MESSAGE_TYPE |
Name of property for the type of message to use.
|
static java.lang.String |
PROP_NO_DEFAULT_CLOSE |
Name of property for toggling the ESC key and title frame button closing.
|
static java.lang.String |
PROP_OPTION_TYPE |
Name of property for the style of options available.
|
static java.lang.String |
PROP_OPTIONS |
Name of property for the exact list of options.
|
static java.lang.String |
PROP_TITLE |
Name of property for the dialog title.
|
static java.lang.String |
PROP_VALID |
Name of property for the OK button validation.
|
static java.lang.String |
PROP_VALUE |
Name of property for the value the user selected.
|
static java.lang.String |
PROP_WARNING_NOTIFICATION |
Name of property for the error message at the bottom of the wizard.
|
static int |
QUESTION_MESSAGE |
Message type for questions.
|
static int |
WARNING_MESSAGE |
Message type for warning messages.
|
static int |
YES_NO_CANCEL_OPTION |
Option type used for negatable and cancellable confirmations.
|
static int |
YES_NO_OPTION |
Option type used for negatable confirmations.
|
static java.lang.Object |
YES_OPTION |
Return value if YES is chosen.
|
| Constructor | Description |
|---|---|
NotifyDescriptor(java.lang.Object message,
java.lang.String title,
int optionType,
int messageType,
java.lang.Object[] options,
java.lang.Object initialValue) |
Creates a new notify descriptor with specified information to report.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
Add a
PropertyChangeListener to the listener list. |
NotificationLineSupport |
createNotificationLineSupport() |
Create
NotificationLineSupport if you want to notify users
using info/warning/error messages in designed line at the bottom
of your dialog. |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue) |
Fire a
PropertyChangeEvent to each listener. |
java.lang.Object[] |
getAdditionalOptions() |
Get the explicit additional choices the user can make.
|
java.lang.Object |
getDefaultValue() |
Get the default value of descriptor.
|
java.lang.Object |
getMessage() |
Get the message object.
|
int |
getMessageType() |
Get the message type.
|
NotificationLineSupport |
getNotificationLineSupport() |
Returns NotificationLineSupport if it was created or
null if doesn't. |
java.lang.Object[] |
getOptions() |
Get the explicit choices the user can make.
|
int |
getOptionType() |
Get the type of options that are to be displayed.
|
java.lang.String |
getTitle() |
Get the title string for this report description.
|
protected static java.lang.String |
getTitleForType(int messageType) |
Get the title to use for the indicated type.
|
java.lang.Object |
getValue() |
Get the value the user has selected.
|
protected void |
initialize() |
Method that is called before a value is returned from any of
getter methods in this object.
|
boolean |
isNoDefaultClose() |
|
boolean |
isValid() |
Return true if OK button is valid (enabled), otherwise return false.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
Remove a
PropertyChangeListener from the listener list. |
void |
setAdditionalOptions(java.lang.Object[] newOptions) |
Define an explicit description of the set of additional user-selectable options.
|
void |
setMessage(java.lang.Object newMessage) |
Define a descriptive message to be reported.
|
void |
setMessageType(int newType) |
Define the style of the message.
|
void |
setNoDefaultClose(boolean noDefaultClose) |
Disable or enabled the closing of dialog window using ESC and the close button
in dialog's title bar.
|
void |
setOptions(java.lang.Object[] newOptions) |
Define an explicit description of the set of user-selectable options.
|
void |
setOptionType(int newType) |
Define the set of options.
|
void |
setTitle(java.lang.String newTitle) |
Set the title string for this report description.
|
void |
setValid(boolean newValid) |
Set validity of OK button.
|
void |
setValue(java.lang.Object newValue) |
Set the value the user has chosen and fires appropriate property change.
|
public static final java.lang.String PROP_MESSAGE
public static final java.lang.String PROP_MESSAGE_TYPE
public static final java.lang.String PROP_OPTION_TYPE
public static final java.lang.String PROP_OPTIONS
public static final java.lang.String PROP_VALUE
public static final java.lang.String PROP_TITLE
public static final java.lang.String PROP_DETAIL
public static final java.lang.String PROP_VALID
public static final java.lang.String PROP_NO_DEFAULT_CLOSE
public static final java.lang.String PROP_ERROR_NOTIFICATION
createNotificationLineSupport()public static final java.lang.String PROP_WARNING_NOTIFICATION
createNotificationLineSupport()public static final java.lang.String PROP_INFO_NOTIFICATION
createNotificationLineSupport()public static final java.lang.Object YES_OPTION
public static final java.lang.Object NO_OPTION
public static final java.lang.Object CANCEL_OPTION
public static final java.lang.Object OK_OPTION
public static final java.lang.Object CLOSED_OPTION
public static final int DEFAULT_OPTION
public static final int YES_NO_OPTION
public static final int YES_NO_CANCEL_OPTION
public static final int OK_CANCEL_OPTION
public static final int ERROR_MESSAGE
public static final int INFORMATION_MESSAGE
public static final int WARNING_MESSAGE
public static final int QUESTION_MESSAGE
public static final int PLAIN_MESSAGE
public NotifyDescriptor(java.lang.Object message,
java.lang.String title,
int optionType,
int messageType,
java.lang.Object[] options,
java.lang.Object initialValue)
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.message - the object to displaytitle - the title string for the dialogoptionType - indicates which options are availablemessageType - indicates what type of message should be displayedoptions - an array of objects indicating the possible choicesinitialValue - the object that represents the default valuegetMessage(),
getMessageType(),
getOptions(),
getOptionType(),
getValue()protected void initialize()
public final boolean isValid()
setValid(boolean)public final void setValid(boolean newValid)
newValid - validity status of OK buttonisValid()public void setMessage(java.lang.Object newMessage)
String. However, the type
of this parameter is actually Object. Its interpretation depends on
its type:
Object[]ComponentComponent is displayed in the dialog.
IconIcon is wrapped in a JLabel and displayed in the dialog.
string representation of the object.
newMessage - the Object to reportgetMessage()public java.lang.Object getMessage()
Object that is to be reportedsetMessage(java.lang.Object)public void setMessageType(int newType)
newType - the kind of messagegetMessageType()public int getMessageType()
setMessageType(int)public void setOptionType(int newType)
newType - the options the look and feel is to displaygetOptionType(),
setOptions(java.lang.Object[])public int getOptionType()
setOptionType(int)public void setOptions(java.lang.Object[] newOptions)
Strings. But the parameter type is an array of Objects. Its
interpretation depends on its type:
ComponentIconJButton is created with this icon as its label.
Object is converted to a string and the result is used to
label a JButton.
newOptions - an array of user-selectable optionsgetOptions()public java.lang.Object[] getOptions()
Objects that give the user's choicessetOptions(java.lang.Object[])public void setAdditionalOptions(java.lang.Object[] newOptions)
The usual value for the options parameter is an array of
Strings. But the parameter type is an array of Objects. Its
interpretation depends on its type:
ComponentIconJButton is created with this icon as its label.
Object is converted to a string and the result is used to
label a JButton.
newOptions - an array of user-selectable optionsgetOptions()public java.lang.Object[] getAdditionalOptions()
Objects that give the user's choicessetOptions(java.lang.Object[])public void setValue(java.lang.Object newValue)
newValue - the chosen valuegetValue()public java.lang.Object getValue()
Object indicating the option selected by the usersetValue(java.lang.Object)public java.lang.Object getDefaultValue()
Object that represents the default valuepublic void setTitle(java.lang.String newTitle)
newTitle - the title of this descriptiongetTitle()public java.lang.String getTitle()
setTitle(java.lang.String)public final NotificationLineSupport createNotificationLineSupport()
NotificationLineSupport if you want to notify users
using info/warning/error messages in designed line at the bottom
of your dialog. These message will be labelled with appropriate icons.
DialogDisplayer.createDialog(org.openide.DialogDescriptor)public final NotificationLineSupport getNotificationLineSupport()
null if doesn't.
WizardDescriptor
which has such capability longer.createNotificationLineSupport()public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to the listener list.listener - the PropertyChangeListener to be addedpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from the listener list.listener - the PropertyChangeListener to be removedprotected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
PropertyChangeEvent to each listener.propertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the propertypublic void setNoDefaultClose(boolean noDefaultClose)
noDefaultClose - True to disabled ESC closing and to disable the close
button in dialog's title bar.WindowConstants.DO_NOTHING_ON_CLOSEpublic boolean isNoDefaultClose()
protected static java.lang.String getTitleForType(int messageType)
messageType - the type of messageBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.