Class Dialogs


  • public final class Dialogs
    extends java.lang.Object
    A utility class for displaying dialogs, similar to JOptionPane but with added functionality.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.swing.JComponent createTextComponentForDialog​(java.lang.String message, boolean isHtml, Dialogs.DialogOptions dialogOptions)
      Create a component to display a String message in a dialog.
      static java.awt.Dialog getCurrentModalDialog()
      Returns the currently active modal dialog shown by Dialogs.
      static javax.swing.text.JTextComponent getFirstTextComponent​(java.awt.Container container)
      Gets the first text component in this container.
      static boolean hasDialogPreference​(java.lang.String preferenceKey)
      Checks whether the option "Remember my preference" or "Don't show again" was selected for dialogs using the given preference key.
      static void resetAllDialogPreferences()
      Reset all the 'Don't ask again' and 'Remember my preference' so that the dialogs will be shown again.
      static void resetDialogPreference​(java.lang.String preferenceKey)
      If the user has previously chosen 'dont ask again' or 'remember my preference' for the given preference key, then reset it.
      static void setCurrentModalDialog​(java.awt.Dialog modalDialog)
      This method can be called just before displaying a modal dialog to let Geneious know that it should avoid popping up other windows such as progress frames while it is visible.
      static void setDefaultDialogOwner​(java.awt.Window defaultOwner)
      FOR INTERNAL USE ONLY, PLUGINS SHOULD NOT CALL THIS METHOD.
      static Dialogs.Result showApplyToAllDialog​(Dialogs.DialogOptions options, java.lang.String message)
      Show a dialog with an "Apply to all" checkbox, which, if checked, signifies that the result from showing this dialog should be used in all cases
      static java.lang.String showComboBoxDialog​(java.lang.String message, java.lang.String[] values, java.lang.String defaultValue, java.lang.String title, java.awt.Component owner)
      Show an OK/Cancel dialog to the user with a non-editable combo-box in it.
      static boolean showContinueCancelDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with "Continue" and "Cancel" buttons.
      static boolean showContinueCancelDialogWithDontShowAgain​(java.lang.String message, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon, java.lang.String preferenceKey)
      Show a dialog to the user with "Continue" and "Cancel" buttons.
      static java.lang.Object showDialog​(Dialogs.DialogOptions options, java.awt.Component component)
      Show a dialog with a custom Component to the user with the specified dialog options.
      static java.lang.Object showDialog​(Dialogs.DialogOptions options, java.awt.Component component, javax.swing.JComponent specialControl)
      Show a dialog with a custom component to the user with the specified dialog options.
      static java.lang.Object showDialog​(Dialogs.DialogOptions options, java.lang.String message)
      Show a dialog with a String message to the user with the specified dialog options.
      static java.lang.Object showDialog​(Dialogs.DialogOptions options, java.lang.String message, javax.swing.JComponent specialControl)
      Show a dialog with a String message to the user with the specified dialog options.
      static java.lang.Object showDialogWithDontShowAgain​(Dialogs.DialogOptions options, java.awt.Component message, java.lang.String preferenceKey, java.lang.String checkBoxLabel)
      Display a dialog to the user with something like a 'Don't show again' check box.
      static java.lang.Object showDialogWithDontShowAgain​(Dialogs.DialogOptions options, java.lang.String message, java.lang.String preferenceKey, java.lang.String checkBoxLabel)
      Display a dialog to the user with something like a 'Don't show again' check box.
      static java.lang.Object showDialogWithRememberMyPreference​(Dialogs.DialogOptions options, java.lang.String message, java.lang.String preferenceKey, java.lang.String checkBoxLabel)
      Show a dialog to the user with a 'Remember my preference' check box.
      static boolean showInputDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner, javax.swing.JComponent... inputComponents)
      Show an OK/Cancel dialog to the user with custom input components.
      static void showMessageDialog​(java.lang.String message)
      Show a dialog to the user with a string message and just an "OK" button.
      static void showMessageDialog​(java.lang.String message, java.lang.String title)
      Show a dialog to the user with a string message and just an "OK" button.
      static void showMessageDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with a string message and just an "OK" button.
      static java.lang.Object showMoreOptionsDialog​(Dialogs.DialogOptions options, java.awt.Component basicComponent, java.awt.Component advancedComponent)
      Show a dialog to the user with two custom components.
      static java.lang.Object showMoreOptionsDialog​(Dialogs.DialogOptions options, java.lang.String basicMessage, java.lang.String advancedMessage)
      Show a dialog to the user with two string messages.
      static void showNonModalOptionsDialog​(Options options, java.lang.String dialogTitle, boolean restoreAndSavePreferences, java.lang.Runnable applyAction, java.lang.Runnable closeAction, javax.swing.JComponent owner)
      Display a non-modal options dialog with "Apply & Close", "Apply", and "Cancel" buttons based on an Options object.
      static boolean showOkCancelDialog​(java.awt.Component component, java.lang.String title, java.awt.Component owner)
      Show a dialog to the user with "OK" and "Cancel" buttons.
      static boolean showOkCancelDialog​(java.awt.Component component, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with "OK" and "Cancel" buttons.
      static boolean showOkCancelDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner)
      Show a dialog to the user with "OK" and "Cancel" buttons.
      static boolean showOkCancelDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with "OK" and "Cancel" buttons.
      static void showOkDialogWithDontShowAgain​(java.awt.Component owner, java.lang.String preferenceKey, java.lang.String message, java.lang.String title)
      Display a dialog to the user with only an OK button and a "Don't show this again" check box.
      static boolean showOptionsDialog​(Options options, java.lang.String dialogTitle, boolean restoreAndSavePreferences)
      Display an options dialog based on an Options object.
      static boolean showOptionsDialog​(Options options, java.lang.String dialogTitle, boolean restoreAndSavePreferences, javax.swing.JComponent owner)
      Display an options dialog based on an Options object.
      static Dialogs.SaveChanges showSaveChangesDialog​(java.lang.String note, java.awt.Component owner)
      Show a save changes dialog that has options equivalent to the values in Dialogs.SaveChanges.
      static java.lang.String showTextFieldDialog​(java.lang.String message, java.lang.String defaultValue, java.lang.String title, java.awt.Component owner)
      Show an OK/Cancel dialog to the user with a text field in it.
      static boolean showYesNoDialog​(java.awt.Component component, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with "Yes" and "No" buttons.
      static boolean showYesNoDialog​(java.lang.String message, java.lang.String title, java.awt.Component owner, Dialogs.DialogIcon dialogIcon)
      Show a dialog to the user with "Yes" and "No" buttons.
      static boolean showYesNoDialogWithRememberMyPreference​(java.awt.Component owner, java.lang.String preferenceKey, java.lang.String message, java.lang.String title)
      Show a dialog to the user with Yes and No buttons and a "Remember my preference" check box.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_FOCUSED_TEXT_COMPONENT_KEY

        public static final java.lang.String DEFAULT_FOCUSED_TEXT_COMPONENT_KEY
        By calling putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value, calling code may nominate that field to be the "first" text component, which will be initially selected when the dialog is displayed.
        Since:
        API 4.600 (Geneious 6.0.0)
        See Also:
        DONT_INITIALLY_FOCUS_KEY, Constant Field Values
      • DONT_INITIALLY_FOCUS_KEY

        public static final java.lang.String DONT_INITIALLY_FOCUS_KEY
        By calling putClientProperty() on a JTextField with this as the key and Boolean.TRUE as the value, calling code may ensure that this text field never gets initially focussed (showOptionsDialog() and showTextFieldDialog() automatically focus the topmost, non-flagged textfield in the dialog).
        Since:
        API 4.600 (Geneious 6.0.0), #DEFAULT_FOCUSED_TEXT_COMPONENT_KEY
        See Also:
        Constant Field Values
      • CONTINUE

        public static final Dialogs.DialogAction CONTINUE
        An action with "Continue" as its label.
        Since:
        API 4.600 (Geneious 6.0.0)
      • OK_ONLY

        public static final Dialogs.DialogAction[] OK_ONLY
        Use this to specify that a dialog should have just an "OK" button.
      • OK_CANCEL

        public static final Dialogs.DialogAction[] OK_CANCEL
        Use this to specify that a dialog should have "OK" and "Cancel" buttons.
      • YES_NO

        public static final Dialogs.DialogAction[] YES_NO
        Use this to specify that a dialog should have "Yes" and "No" buttons.
      • YES_NO_CANCEL

        public static final Dialogs.DialogAction[] YES_NO_CANCEL
        Use this to specify that a dialog should have "Yes", "No" and "Cancel" buttons.
      • CONTINUE_CANCEL

        public static final Dialogs.DialogAction[] CONTINUE_CANCEL
        Use this to specify that a dialog should have "Continue" and "Cancel" buttons.
        Since:
        API 4.600 (Geneious 6.0.0)
    • Method Detail

      • showYesNoDialogWithRememberMyPreference

        public static boolean showYesNoDialogWithRememberMyPreference​(java.awt.Component owner,
                                                                      java.lang.String preferenceKey,
                                                                      java.lang.String message,
                                                                      java.lang.String title)
        Show a dialog to the user with Yes and No buttons and a "Remember my preference" check box. If the user checks this box then any time this method is called with the same key it will return the user's preference immediately without prompting.

        Use resetDialogPreference(String) to have this prompt the user again on next call.

        If the dialog is displayed, this method will block until the user has clicked Yes or No.

        Parameters:
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        preferenceKey - the key used to store the default value if the user checks "Remember my preference"
        message - message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        Returns:
        true if user clicked Yes, false for No.
      • showOkDialogWithDontShowAgain

        public static void showOkDialogWithDontShowAgain​(java.awt.Component owner,
                                                         java.lang.String preferenceKey,
                                                         java.lang.String message,
                                                         java.lang.String title)
        Display a dialog to the user with only an OK button and a "Don't show this again" check box. If the user checks this box then next time this method is called, the dialog will not be shown to the user if it is called with the same preference key and this method will return immediately.

        If the dialog is displayed, this method will block until the user has clicked Ok.

        Parameters:
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        preferenceKey - the key used to remember whether the user chose "Don't show this again"
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
      • showDialogWithDontShowAgain

        public static java.lang.Object showDialogWithDontShowAgain​(Dialogs.DialogOptions options,
                                                                   java.lang.String message,
                                                                   java.lang.String preferenceKey,
                                                                   java.lang.String checkBoxLabel)
        Display a dialog to the user with something like a 'Don't show again' check box. If the user checks this box then next time this method is called, the dialog will not be shown to the user if it is called with the same preference key and this method will return null immediately.

        If the dialog is displayed and Dialogs.DialogOptions.isModal() is true, This method will block until the user has clicked Ok.

        Parameters:
        options - DialogOptions specifying the properties of the dialog
        message - Message to display in the dialog
        preferenceKey - the key used to remember whether the user chose 'Don't show again'
        checkBoxLabel - The text to use on the 'Don't show again' check box. DONT_SHOW_AGAIN is recommended
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction) or null if "don't show again" was previously selected.
      • showDialogWithDontShowAgain

        public static java.lang.Object showDialogWithDontShowAgain​(Dialogs.DialogOptions options,
                                                                   java.awt.Component message,
                                                                   java.lang.String preferenceKey,
                                                                   java.lang.String checkBoxLabel)
        Display a dialog to the user with something like a 'Don't show again' check box. If the user checks this box then next time this method is called, the dialog will not be shown to the user if it is called with the same preference key and this method will return null immediately.

        If the dialog is displayed and Dialogs.DialogOptions.isModal() is true, This method will block until the user has clicked Ok.

        Parameters:
        options - DialogOptions specifying the properties of the dialog
        message - Message to display in the dialog
        preferenceKey - the key used to remember whether the user chose 'Don't show again'
        checkBoxLabel - The text to use on the 'Don't show again' check box. DONT_SHOW_AGAIN is recommended
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction) or null if "don't show again" was previously selected.
      • showDialogWithRememberMyPreference

        public static java.lang.Object showDialogWithRememberMyPreference​(Dialogs.DialogOptions options,
                                                                          java.lang.String message,
                                                                          java.lang.String preferenceKey,
                                                                          java.lang.String checkBoxLabel)
        Show a dialog to the user with a 'Remember my preference' check box. If the user checks this box then any time this method is called with the same key it will return the user's preference immediately without prompting.

        Use resetDialogPreference(String) to have this prompt the user again on next call.

        If the dialog is displayed and Dialogs.DialogOptions.isModal() is true, This method will block until the user has clicked Ok.

        Parameters:
        options - DialogOptions specifying the properties of the dialog
        message - Message to display in the dialog
        preferenceKey - the key used to remember whether the user chose 'Don't show again'
        checkBoxLabel - The text to use on the 'Don't show again' check box.
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showOptionsDialog

        public static boolean showOptionsDialog​(Options options,
                                                java.lang.String dialogTitle,
                                                boolean restoreAndSavePreferences)
        Display an options dialog based on an Options object.

        This method will block until the user has clicked Ok or Cancel.

        Parameters:
        options - the options to be displayed
        dialogTitle - the title of the dialog (used as a preference key as well) For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        restoreAndSavePreferences - if true, then we restore Options preferences from persistent storage before the dialog is displayed and save them again when they user clicks OK. Otherwise the current option values are used and the results aren't saved to persistent storage.
        Returns:
        false if user canceled, true if clicked OK.
      • showOptionsDialog

        public static boolean showOptionsDialog​(Options options,
                                                java.lang.String dialogTitle,
                                                boolean restoreAndSavePreferences,
                                                javax.swing.JComponent owner)
        Display an options dialog based on an Options object.

        This method will block until the user has clicked Ok or Cancel.

        Parameters:
        options - the options to be displayed
        dialogTitle - the title of the dialog (used as a preference key as well) For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        restoreAndSavePreferences - if true, then we restore Options preferences from persistent storage before the dialog is displayed and save them again when they user clicks OK. Otherwise the current option values are used and the results aren't saved to persistent storage.
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner. If the Options.getDialogOptions() method of the options passed returns a non-null value, the method will ignore the owner pass in here in favor of the one from the options.
        Returns:
        false if user canceled, true if clicked OK.
      • showNonModalOptionsDialog

        public static void showNonModalOptionsDialog​(Options options,
                                                     java.lang.String dialogTitle,
                                                     boolean restoreAndSavePreferences,
                                                     java.lang.Runnable applyAction,
                                                     java.lang.Runnable closeAction,
                                                     javax.swing.JComponent owner)
        Display a non-modal options dialog with "Apply & Close", "Apply", and "Cancel" buttons based on an Options object.

        This method will return before the user dismisses the dialog.

        Parameters:
        options - the options to be displayed
        dialogTitle - the title of the dialog (used as a preference key as well) For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        restoreAndSavePreferences - if true, then we restore Options preferences from persistent storage before the dialog is displayed and save them again when they user clicks OK. Otherwise the current option values are used and the results aren't saved to persistent storage.
        applyAction - a callback which will be invoked when the user clicks "Apply & Close" or "Apply"
        closeAction - a callback which will be invoked when the user clicks "Apply & Close", "Cancel", or closes the dialog
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner. If the Options.getDialogOptions() method of the options passed returns a non-null value, the method will ignore the owner pass in here in favor of the one from the options.
        Since:
        API 4.202110 (Geneious 2021.1.0)
      • showApplyToAllDialog

        public static Dialogs.Result showApplyToAllDialog​(Dialogs.DialogOptions options,
                                                          java.lang.String message)
        Show a dialog with an "Apply to all" checkbox, which, if checked, signifies that the result from showing this dialog should be used in all cases
        Parameters:
        options - the options to be displayed
        message - Message to display in the dialog
        Returns:
        the result of showing the dialog
      • resetAllDialogPreferences

        public static void resetAllDialogPreferences()
        Reset all the 'Don't ask again' and 'Remember my preference' so that the dialogs will be shown again.
        See Also:
        resetDialogPreference(String)
      • showDialog

        public static java.lang.Object showDialog​(Dialogs.DialogOptions options,
                                                  java.lang.String message)
        Show a dialog with a String message to the user with the specified dialog options.
        Parameters:
        options - DialogOptions specifying the properties of the dialog
        message - Message to display in the dialog
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showDialog

        public static java.lang.Object showDialog​(Dialogs.DialogOptions options,
                                                  java.awt.Component component)
        Show a dialog with a custom Component to the user with the specified dialog options.
        Parameters:
        options - DialogOptions specifying the properties of the dialog
        component - Component to display in the dialog
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showDialog

        public static java.lang.Object showDialog​(Dialogs.DialogOptions options,
                                                  java.lang.String message,
                                                  javax.swing.JComponent specialControl)
        Show a dialog with a String message to the user with the specified dialog options. Also contains a special component in the bottom left.
        Parameters:
        options - DialogOptions specifying the properties of the dialog
        message - Message to display in the dialog
        specialControl - a component that will be placed in the bottom left. Eg More Options or Dont ask again.
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showDialog

        public static java.lang.Object showDialog​(Dialogs.DialogOptions options,
                                                  java.awt.Component component,
                                                  javax.swing.JComponent specialControl)
        Show a dialog with a custom component to the user with the specified dialog options. Also contains a special component in the bottom left.
        Parameters:
        options - DialogOptions specifying the properties of the dialog
        component - Component to display in the dialog
        specialControl - a component that will be placed in the bottom left. Eg More Options or Dont ask again.
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • getCurrentModalDialog

        public static java.awt.Dialog getCurrentModalDialog()
        Returns the currently active modal dialog shown by Dialogs.
        Returns:
        the currently active modal dialog or null if no modal dialog is currently active.
      • setCurrentModalDialog

        public static void setCurrentModalDialog​(java.awt.Dialog modalDialog)
        This method can be called just before displaying a modal dialog to let Geneious know that it should avoid popping up other windows such as progress frames while it is visible. This method listens for when the dialog is closed and de-references it appropriately.

        It is not necessary to call this if you are displaying a dialog using one of the show* methods in this class. Only use this if you are constructing your own modal dialog.

        Parameters:
        modalDialog - a modal dialog which is about to be displayed
        Throws:
        java.lang.IllegalArgumentException - if modalDialog returns false from Dialog.isModal()
        java.lang.NullPointerException - if modalDialog is null
      • getFirstTextComponent

        public static javax.swing.text.JTextComponent getFirstTextComponent​(java.awt.Container container)
        Gets the first text component in this container. Useful for finding an appropriate component to focus
        Parameters:
        container - the container to look for the component in
        Returns:
        the first text component or null if one isn't found
        Since:
        API 4.600 (Geneious 6.0.0)
      • showMoreOptionsDialog

        public static java.lang.Object showMoreOptionsDialog​(Dialogs.DialogOptions options,
                                                             java.lang.String basicMessage,
                                                             java.lang.String advancedMessage)
        Show a dialog to the user with two string messages. The basic message is visible to the user initially and the advanced message becomes visible only when the user clicks a 'More Options' button in the lower left corner of the dialog. The advanced message can then be hidden by clicking the 'More Options' button again.

        The text on the 'More Options' button is specified by the DialogOptions.

        Parameters:
        options - DialogOptions specifying the properties of the dialog
        basicMessage - Message initially visible to the user.
        advancedMessage - Message that is displayed when the user clicks 'More Options'. A null value will simply not show a "More Options" button.
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showMoreOptionsDialog

        public static java.lang.Object showMoreOptionsDialog​(Dialogs.DialogOptions options,
                                                             java.awt.Component basicComponent,
                                                             java.awt.Component advancedComponent)
        Show a dialog to the user with two custom components. The basic component is visible to the user initially and the advanced component becomes visible only when the user clicks a 'More Options' button in the lower left corner of the dialog. The advanced component can then be hidden by clicking the 'More Options' button again.

        The text on the 'More Options' button is specified by the DialogOptions.

        Parameters:
        options - DialogOptions specifying the properties of the dialog
        basicComponent - Component initially visible to the user.
        advancedComponent - Component that is displayed when the user clicks 'More Options'
        Returns:
        the button object passed in to the constructor of DialogOptions that corresponds to the button clicked by the user (either a String or Dialogs.DialogAction).
      • showContinueCancelDialog

        public static boolean showContinueCancelDialog​(java.lang.String message,
                                                       java.lang.String title,
                                                       java.awt.Component owner,
                                                       Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with "Continue" and "Cancel" buttons.
        Parameters:
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        Returns:
        true if "Continue" clicked, false if "Cancel" clicked or the dialog was closed.
        Since:
        API 4.600 (Geneious 6.0.0)
      • showContinueCancelDialogWithDontShowAgain

        public static boolean showContinueCancelDialogWithDontShowAgain​(java.lang.String message,
                                                                        java.lang.String title,
                                                                        java.awt.Component owner,
                                                                        Dialogs.DialogIcon dialogIcon,
                                                                        java.lang.String preferenceKey)
        Show a dialog to the user with "Continue" and "Cancel" buttons.
        Parameters:
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        preferenceKey - the preference key used to remember whether the user chose 'Don't show again' for this particular dialog
        Returns:
        true if "Continue" clicked or if the user has previously chosen not to show this dialog again. false if "Cancel" clicked or the dialog was closed.
        Since:
        API 4.1000 (Geneious 10.0.0)
      • showOkCancelDialog

        public static boolean showOkCancelDialog​(java.lang.String message,
                                                 java.lang.String title,
                                                 java.awt.Component owner)
        Show a dialog to the user with "OK" and "Cancel" buttons.
        Parameters:
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        true if "OK" clicked, false if "Cancel" clicked or the dialog was closed.
      • showOkCancelDialog

        public static boolean showOkCancelDialog​(java.awt.Component component,
                                                 java.lang.String title,
                                                 java.awt.Component owner)
        Show a dialog to the user with "OK" and "Cancel" buttons.
        Parameters:
        component - Component to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        true if "OK" clicked, false if "Cancel" clicked or the dialog was closed.
      • showOkCancelDialog

        public static boolean showOkCancelDialog​(java.lang.String message,
                                                 java.lang.String title,
                                                 java.awt.Component owner,
                                                 Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with "OK" and "Cancel" buttons.
        Parameters:
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        Returns:
        true if "OK" clicked, false if "Cancel" clicked or the dialog was closed.
      • showOkCancelDialog

        public static boolean showOkCancelDialog​(java.awt.Component component,
                                                 java.lang.String title,
                                                 java.awt.Component owner,
                                                 Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with "OK" and "Cancel" buttons.
        Parameters:
        component - Component to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        Returns:
        true if "OK" clicked, false if "Cancel" clicked or the dialog was closed.
      • showYesNoDialog

        public static boolean showYesNoDialog​(java.lang.String message,
                                              java.lang.String title,
                                              java.awt.Component owner,
                                              Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with "Yes" and "No" buttons.
        Parameters:
        message - Message to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        Returns:
        true if "Yes" clicked, false if "No" clicked or the dialog was closed.
      • showYesNoDialog

        public static boolean showYesNoDialog​(java.awt.Component component,
                                              java.lang.String title,
                                              java.awt.Component owner,
                                              Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with "Yes" and "No" buttons.
        Parameters:
        component - Component to display in the dialog
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
        Returns:
        true if "Yes" clicked, false if "No" clicked or the dialog was closed.
      • setDefaultDialogOwner

        public static void setDefaultDialogOwner​(java.awt.Window defaultOwner)
        FOR INTERNAL USE ONLY, PLUGINS SHOULD NOT CALL THIS METHOD.

        Sets the default onwer for dialogs created by this class (ie. if null is passed in as an owner).

        Parameters:
        defaultOwner - the default onwer for dialogs created by this class
      • showSaveChangesDialog

        public static Dialogs.SaveChanges showSaveChangesDialog​(java.lang.String note,
                                                                java.awt.Component owner)
        Show a save changes dialog that has options equivalent to the values in Dialogs.SaveChanges. The message is something like:

        Do you want to save changes?

        Custom note
        Parameters:
        note - An additional note for the user that appears under "Do you want to save changes?" or null for none. E.g. "Changes must be saved before you can switch to another sequence."
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        One of Dialogs.SaveChanges, never null.
        Since:
        API 4.51 (Geneious 5.5.1)
      • showMessageDialog

        public static void showMessageDialog​(java.lang.String message,
                                             java.lang.String title,
                                             java.awt.Component owner,
                                             Dialogs.DialogIcon dialogIcon)
        Show a dialog to the user with a string message and just an "OK" button.

        This method will block until the user has clicked Ok.

        Parameters:
        message - Message to display in the dialog.
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        dialogIcon - DialogIcon of the icon to display on the left of the dialog. Must not be null.
      • showMessageDialog

        public static void showMessageDialog​(java.lang.String message,
                                             java.lang.String title)
        Show a dialog to the user with a string message and just an "OK" button. It has an information icon and its owner is the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null)

        This method will block until the user has clicked Ok.

        Parameters:
        message - Message to display in the dialog.
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
      • showMessageDialog

        public static void showMessageDialog​(java.lang.String message)
        Show a dialog to the user with a string message and just an "OK" button. It has an information icon and its owner is the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null). It has no title.

        This method will block until the user has clicked Ok.

        Parameters:
        message - Message to display in the dialog.
      • createTextComponentForDialog

        public static javax.swing.JComponent createTextComponentForDialog​(java.lang.String message,
                                                                          boolean isHtml,
                                                                          Dialogs.DialogOptions dialogOptions)
        Create a component to display a String message in a dialog. The component is sized especially for the dialog based on the dialog options.
        Parameters:
        message - the message string to be put into the component
        isHtml - true if the message string is HTML formatted
        dialogOptions - DialogOptions for the dialog that the text will be in
        Returns:
        a component to display a String message in a dialog
      • showTextFieldDialog

        public static java.lang.String showTextFieldDialog​(java.lang.String message,
                                                           java.lang.String defaultValue,
                                                           java.lang.String title,
                                                           java.awt.Component owner)
        Show an OK/Cancel dialog to the user with a text field in it.
        Parameters:
        message - Message to display in the dialog above the text field
        defaultValue - Initial value in the text field (or null for empty)
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        the value entered or null if the user cancelled or closed the dialog.
      • showComboBoxDialog

        public static java.lang.String showComboBoxDialog​(java.lang.String message,
                                                          java.lang.String[] values,
                                                          java.lang.String defaultValue,
                                                          java.lang.String title,
                                                          java.awt.Component owner)
        Show an OK/Cancel dialog to the user with a non-editable combo-box in it.
        Parameters:
        message - Message to display in the dialog above the combo-box
        values - An array of the values in the combo-box.
        defaultValue - Initial value to be selected in the combo-box (must be one of the values)
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        the value selected or null if the user cancelled or close the dialog.
      • showInputDialog

        public static boolean showInputDialog​(java.lang.String message,
                                              java.lang.String title,
                                              java.awt.Component owner,
                                              javax.swing.JComponent... inputComponents)
        Show an OK/Cancel dialog to the user with custom input components. The values entered in the components must be retrieved from the components by the caller, after this method returns.

        The components are layed out one under the other below the message.

        Parameters:
        message - Message to display in the dialog above the components
        inputComponents - Custom components for the user to enter input
        title - Title of the dialog. For correct capitalisation, see TitleCap using option 'Capitalize words with five or more letters' (based on Use the Right Capitalization Style in Labels and Text)
        owner - Any component within the Window which will be the owner of this dialog. If null, the currently focused document frame (or JDialog with getClientProperty(ALLOW_AS_PARENT) != null) is used as the owner.
        Returns:
        true if "OK" clicked, false if "Cancel" clicked or the dialog is closed.