Class Dialogs


  • public final class Dialogs
    extends java.lang.Object
    Provides utility methods for showing dialogs of various types.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Dialogs.ValidatingPane
      Dialog contents which is validated.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object displayOkCancel​(java.lang.Object innerPane, java.lang.String title)
      Displays a plain OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button and no help context.
      static java.lang.Object displayOkCancel​(java.lang.Object innerPane, java.lang.String title, int messageType)
      Displays OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button and no help context.
      static java.lang.Object displayOkCancel​(java.lang.Object innerPane, java.lang.String title, int messageType, org.openide.util.HelpCtx helpCtx)
      Displays OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button.
      static java.lang.Object displayOkCancel​(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx)
      Displays OK/Cancel dialog.
      static java.lang.Object displayOkCancel​(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx, java.lang.String dimensionKey)
      Displays OK/Cancel dialog.
      static java.lang.Object displaySaveDontSaveCancel​(Dialogs.ValidatingPane innerPane, java.lang.String title)
      Displays validating dialog with options "Save", "Don't Save" and "Cancel".
      static void setMinimumSize​(javax.swing.JComponent comp, java.awt.Dimension size)
      Sets minimum dialog size to panel displayed using Dialogs
      static void showError​(java.lang.String message)
      Show error dialog with the given message using NetBeans Dialogs API.
      static void showInfo​(java.lang.String message)
      Show information dialog with the given message using NetBeans Dialogs API.
      static void showMessage​(java.lang.String message, int messageType)
      Show dialog with the given message using NetBeans Dialogs API.
      static void showMessage​(java.lang.String message, int messageType, java.lang.String title)
      Show dialog with the given message using NetBeans Dialogs API.
      static void showWarning​(java.lang.String message)
      Show warning dialog with the given message using NetBeans Dialogs API.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • showMessage

        public static void showMessage​(java.lang.String message,
                                       int messageType)
        Show dialog with the given message using NetBeans Dialogs API. Second parameter decides what type of dialog will be shown. Use constants from NotifyDescriptor API, like NotifyDescriptor.INFORMATION_MESSAGE.
        Parameters:
        message - message to be shown
        messageType - type of the message - informational, waring, error, etc.
      • showMessage

        public static void showMessage​(java.lang.String message,
                                       int messageType,
                                       java.lang.String title)
        Show dialog with the given message using NetBeans Dialogs API. Second parameter decides what type of dialog will be shown. Use constants from NotifyDescriptor API, like NotifyDescriptor.INFORMATION_MESSAGE.
        Parameters:
        message - message to be shown
        messageType - type of the message - informational, waring, error, etc.
        title - title of the dialog
        Since:
        22.6.0
      • showInfo

        public static void showInfo​(java.lang.String message)
        Show information dialog with the given message using NetBeans Dialogs API.
        Parameters:
        message - message to be shown
      • showError

        public static void showError​(java.lang.String message)
        Show error dialog with the given message using NetBeans Dialogs API.
        Parameters:
        message - message to be shown
      • showWarning

        public static void showWarning​(java.lang.String message)
        Show warning dialog with the given message using NetBeans Dialogs API.
        Parameters:
        message - message to be shown
        Since:
        22.6.0
      • displayOkCancel

        public static java.lang.Object displayOkCancel​(java.lang.Object innerPane,
                                                       java.lang.String title,
                                                       java.lang.Object okOption,
                                                       int messageType,
                                                       org.openide.util.HelpCtx helpCtx)
        Displays OK/Cancel dialog. The supplied parameters control the dialog's contents, title, OK or approve button, etc. This method is a simplified version of DialogDescriptor calls.
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        okOption - the OK button
        messageType - the type of the dialog, see NotifyDescriptor constants
        helpCtx - help context for the dialog, can be null for no help
        Returns:
        Either okOption or NotifyDescriptor.CANCEL_OPTION depending on what button a user hits.
        Since:
        6.1
      • displayOkCancel

        public static java.lang.Object displayOkCancel​(java.lang.Object innerPane,
                                                       java.lang.String title,
                                                       java.lang.Object okOption,
                                                       int messageType,
                                                       org.openide.util.HelpCtx helpCtx,
                                                       java.lang.String dimensionKey)
        Displays OK/Cancel dialog. The supplied parameters control the dialog's contents, title, OK or approve button, etc. This method is a simplified version of DialogDescriptor calls.
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        okOption - the OK button
        messageType - the type of the dialog, see NotifyDescriptor constants
        helpCtx - help context for the dialog, can be null for no help
        dimensionKey - used for remembering bounds of shown dialog. When this method is called for the first time the size of a dialog at the point it was closed is remembered. Upon next invocation of this method with the same dimensionKey dialog will be shown with the remembered bounds and new bounds will be remembered again. Bounds are remembered across JVM sessions.
        Returns:
        Either okOption or NotifyDescriptor.CANCEL_OPTION depending on what button a user hits.
        Since:
        6.2
      • displayOkCancel

        public static java.lang.Object displayOkCancel​(java.lang.Object innerPane,
                                                       java.lang.String title,
                                                       int messageType,
                                                       org.openide.util.HelpCtx helpCtx)
        Displays OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button.
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        messageType - the type of the dialog, see NotifyDescriptor constants
        helpCtx - help context for the dialog, can be null for no help
        Returns:
        Either NotifyDescriptor.OK_OPTION or NotifyDescriptor.CANCEL_OPTION depending on what button a user hits.
      • displayOkCancel

        public static java.lang.Object displayOkCancel​(java.lang.Object innerPane,
                                                       java.lang.String title,
                                                       int messageType)
        Displays OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button and no help context.
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        messageType - the type of the dialog, see NotifyDescriptor constants
        Returns:
        Either NotifyDescriptor.OK_OPTION or NotifyDescriptor.CANCEL_OPTION depending on what button a user hits.
      • displayOkCancel

        public static java.lang.Object displayOkCancel​(java.lang.Object innerPane,
                                                       java.lang.String title)
        Displays a plain OK/Cancel dialog with the default NotifyDescriptor.OK_OPTION button and no help context.
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        Returns:
        Either NotifyDescriptor.OK_OPTION or NotifyDescriptor.CANCEL_OPTION depending on what button a user hits.
      • displaySaveDontSaveCancel

        public static java.lang.Object displaySaveDontSaveCancel​(Dialogs.ValidatingPane innerPane,
                                                                 java.lang.String title)
        Displays validating dialog with options "Save", "Don't Save" and "Cancel".
        Parameters:
        innerPane - contents of dialog
        title - title of dialog
        Returns:
        NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION or NotifyDescriptor.CANCEL_OPTION if user chooses Save, Don't Save or Cancel respectively.
      • setMinimumSize

        public static void setMinimumSize​(javax.swing.JComponent comp,
                                          java.awt.Dimension size)
        Sets minimum dialog size to panel displayed using Dialogs
        Parameters:
        comp -
        size -