Class Dialogs


  • public final class Dialogs
    extends Object
    A utility class for displaying Dialogs.
    • Method Detail

      • loginDialog

        public static LoginDialogBuilder loginDialog()
        Returns:
        a new login dialog builder
      • exceptionDialog

        public static ExceptionDialogBuilder exceptionDialog()
        Returns:
        a new exception dialog builder
      • selectionDialog

        public static <T> SelectionDialogBuilder<T> selectionDialog​(Collection<T> values)
        Type Parameters:
        T - the value type
        Parameters:
        values - the values to select from
        Returns:
        a new selection dialog builder
        Throws:
        IllegalArgumentException - in case values is empty
      • okCancelDialog

        public static OkCancelDialogBuilder okCancelDialog​(JComponent component)
        Parameters:
        component - the component to display
        Returns:
        a new OkCancelDialogBuilder
      • calendarDialog

        public static CalendarDialogBuilder calendarDialog()
        Returns:
        a new CalendarDialogBuilder
      • lookAndFeelSelectionDialog

        public static LookAndFeelSelectionDialogBuilder lookAndFeelSelectionDialog()
        Returns:
        a builder for a dialog for selecting a look and feel
      • showInputDialog

        public static <T,​C extends JComponent> T showInputDialog​(ComponentValue<T,​C> componentValue,
                                                                       JComponent dialogOwner)
        Displays the component from the given component value in a dialog and returns the value if the user accepts the input.
        Type Parameters:
        T - the value type
        C - the component type
        Parameters:
        componentValue - the component value
        dialogOwner - the dialog owner
        Returns:
        the value from the component value if the user accepts the input
        Throws:
        CancelException - if the user cancels
      • showInputDialog

        public static <T,​C extends JComponent> T showInputDialog​(ComponentValue<T,​C> componentValue,
                                                                       JComponent dialogOwner,
                                                                       String title)
        Displays the component from the given component value in a dialog and returns the value if the user accepts the input.
        Type Parameters:
        T - the value type
        C - the component type
        Parameters:
        componentValue - the component value
        dialogOwner - the dialog owner
        title - the dialog title
        Returns:
        the value from the component value if the user accepts the input
        Throws:
        CancelException - if the user cancels
      • selectionProvider

        public static <T> SelectionProvider<T> selectionProvider​(Supplier<Collection<T>> valueSupplier)
        Returns a SelectionProvider implmentation based on a selection dialog.
        Type Parameters:
        T - the type of values being looked up
        Parameters:
        valueSupplier - supplies the values for the selection dialog
        Returns:
        a new SelectionProvider based on a selection dialog
      • showExceptionDialog

        public static void showExceptionDialog​(Throwable exception,
                                               Window dialogParent)
        Displays the given exception in a dialog
        Parameters:
        exception - the exception
        dialogParent - the dialog parent window
      • createBrowseAction

        public static Action createBrowseAction​(JTextField filenameField)
        Creates an Action instance, with a triple-dot name ('...') for selecting a file path to display in the given text field
        Parameters:
        filenameField - the text field for displaying the file path
        Returns:
        the Action