cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

NotifyDescriptor.Confirmation

This class has six constructors:
  1. NotifyDescriptor.Confirmation(Object message)  --  create a yes/no/cancel question with default title.
  2. NotifyDescriptor.Confirmation(Object message, int optionType) -- create a question with default title.
  3. NotifyDescriptor.Confirmation(Object message, int optionType, int messageType) -- create a confirmation with default title.
  4. NotifyDescriptor.Confirmation(Object message, String title) -- create a yes/no/cancel question.
  5. NotifyDescriptor.Confirmation(Object message, String title, int optionType) -- create a question.
  6. NotifyDescriptor.Confirmation(Object message, String title, int optionType, int messageType) -- create a confirmation.
    • messageTypes:
      • information icon -- NotifyDescriptor.INFORMATION_MESSAGE
      • warning icon -- NotifyDescriptor.WARNING_MESSAGE
      • error icon -- NotifyDescriptor.ERROR_MESSAGE
      • question icon -- NotifyDescriptor.QUESTION_MESSAGE
      • plain icon -- NotifyDescriptor.PLAIN_MESSAGE
    • optionTypes:
      • display defaults -- NotifyDescriptor.DEFAULT_OPTION
      • display yes/no buttons -- NotifyDescriptor.YES_NO_OPTION
      • display yes/no/cancel buttons -- NotifyDescriptor.YES_NO_CANCEL_OPTION
      • display ok/cancel buttons -- NotifyDescriptor.OK_CANCEL_OPTION


An important method inherited from NotifyDescriptor:
Object getValue() -- get the value the user has selected. Allows you determine which button was pressed.

Example:

NotifyDescriptor.Confirmation cf = new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.",NotifyDescriptor.YES_NO_OPTION);
TopManager.getDefault ().notify (cf);
if(cf.getValue()==NotifyDescriptor.CANCEL_OPTION){

    //if Cancel was pressed do...

}
else{

    //else do...

}

 Example of the first constructor:
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green."));

 Example of the second constructor:
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.",
NotifyDescriptor.DEFAULT_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.",
NotifyDescriptor.YES_NO_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.",
NotifyDescriptor.YES_NO_CANCEL_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.",
NotifyDescriptor.PLAIN_MESSAGE));

 Example of the third constructor:
 Same as sixth constructor, only title depends on argument messageType (similary with second constructor of  NotifyDescriptor.Message)

 Example of the fourth constructor:
TopManager.getDefault ().notify (new 
NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", "Inane title")); 

 Example of the fifth constructor:
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title",
NotifyDescriptor.DEFAULT_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title",
NotifyDescriptor.YES_NO_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title",
NotifyDescriptor.YES_NO_CANCEL_OPTION));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title",
NotifyDescriptor.NotifyDescriptor.OK_CANCEL_OPTION));

 Example of the sixth constructor (some combinations are strange):
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.DEFAULT_OPTION, 
NotifyDescriptor.INFORMATION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_OPTION, 
NotifyDescriptor.INFORMATION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_CANCEL_OPTION, 
NotifyDescriptor.INFORMATION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.INFORMATION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_OPTION, 
NotifyDescriptor.WARNING_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_OPTION, 
NotifyDescriptor.WARNING_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_CANCEL_OPTION, 
NotifyDescriptor.WARNING_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.WARNING_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.DEFAULT_OPTION, 
NotifyDescriptor.ERROR_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_OPTION, 
NotifyDescriptor.ERROR_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_CANCEL_OPTION, 
NotifyDescriptor.ERROR_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.ERROR_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.DEFAULT_OPTION, 
NotifyDescriptor.QUESTION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_OPTION, 
NotifyDescriptor.QUESTION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_CANCEL_OPTION, 
NotifyDescriptor.QUESTION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.QUESTION_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.DEFAULT_OPTION, 
NotifyDescriptor.PLAIN_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_OPTION, 
NotifyDescriptor.PLAIN_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.YES_NO_CANCEL_OPTION, 
NotifyDescriptor.PLAIN_MESSAGE));
TopManager.getDefault ().notify (new NotifyDescriptor.Confirmation("Eggs aren't supposed to be green.", 
"Inane title", 
NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.PLAIN_MESSAGE));

Companion
Projects:
MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
Sponsored by Sun Microsystems