Class ArgumentsDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ArgumentsDialog extends JDialog
Represents a dialog that allows users to input arguments for a command-line program. The dialog displays a list of options, each with an input field for the user to provide the corresponding value. The dialog provides an "OK" button to accept the input and a "Cancel" button to close the dialog without saving the input.

Usage: ArgumentsParser parser = new ArgumentsParser(); // Add options to the parser ArgumentsDialog.showDialog(window, parser); Optional<Arguments> arguments = ArgumentsDialog.showDialog(window, parser);

See Also:
  • Constructor Details

    • ArgumentsDialog

      public ArgumentsDialog(Window owner, ArgumentsParser parser, String title)
      Creates a new ArgumentsDialog with the specified owner, parser, and title. The dialog is displayed as a modal dialog and blocks input from other windows. The dialog contains an ArgumentsPanel with the specified parser and callback methods for when the dialog is closed or canceled.
      Parameters:
      owner - the owner Window of the dialog
      parser - the ArgumentsParser used by the dialog to parse arguments
      title - the title of the dialog
  • Method Details

    • showDialog

      public static Optional<Arguments> showDialog(Window owner, ArgumentsParser parser)
      Displays a dialog for getting arguments from the user.
      Parameters:
      owner - the Window object that owns the dialog
      parser - the ArgumentsParser object used to parse the arguments
      Returns:
      an Optional containing the Arguments obtained from the user, or an empty Optional if the user cancels the dialog