Class TextInputDialog

  • All Implemented Interfaces:
    BasePane, Composite, Window

    public class TextInputDialog
    extends DialogWindow
    TextInputDialog is a modal text input dialog that prompts the user to enter a text string. The class supports validation and password masking. The builder class to help setup TextInputDialogs is TextInputDialogBuilder.
    • Constructor Detail

      • TextInputDialog

        TextInputDialog​(java.lang.String title,
                        java.lang.String description,
                        TerminalSize textBoxPreferredSize,
                        java.lang.String initialContent,
                        TextInputDialogResultValidator validator,
                        boolean password)
    • Method Detail

      • onOK

        private void onOK()
      • onCancel

        private void onCancel()
      • showDialog

        public java.lang.String showDialog​(WindowBasedTextGUI textGUI)
        Description copied from class: DialogWindow
        Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closed
        Overrides:
        showDialog in class DialogWindow
        Parameters:
        textGUI - Text GUI to add the dialog to
        Returns:
        Depending on the DialogWindow implementation, by default null
      • showDialog

        public static java.lang.String showDialog​(WindowBasedTextGUI textGUI,
                                                  java.lang.String title,
                                                  java.lang.String description,
                                                  java.lang.String initialContent)
        Shortcut for quickly showing a TextInputDialog
        Parameters:
        textGUI - GUI to show the dialog on
        title - Title of the dialog
        description - Description of the dialog
        initialContent - What content to place in the text box initially
        Returns:
        The string the user typed into the text box, or null if the dialog was cancelled
      • showNumberDialog

        public static java.math.BigInteger showNumberDialog​(WindowBasedTextGUI textGUI,
                                                            java.lang.String title,
                                                            java.lang.String description,
                                                            java.lang.String initialContent)
        Shortcut for quickly showing a TextInputDialog that only accepts numbers
        Parameters:
        textGUI - GUI to show the dialog on
        title - Title of the dialog
        description - Description of the dialog
        initialContent - What content to place in the text box initially
        Returns:
        The number the user typed into the text box, or null if the dialog was cancelled
      • showPasswordDialog

        public static java.lang.String showPasswordDialog​(WindowBasedTextGUI textGUI,
                                                          java.lang.String title,
                                                          java.lang.String description,
                                                          java.lang.String initialContent)
        Shortcut for quickly showing a TextInputDialog with password masking
        Parameters:
        textGUI - GUI to show the dialog on
        title - Title of the dialog
        description - Description of the dialog
        initialContent - What content to place in the text box initially
        Returns:
        The string the user typed into the text box, or null if the dialog was cancelled