Dialog
This object provides convenience methods for displaying messages and reading user input via simple Swing dialogs.
Attributes
- Graph
-
- Supertypes
- Self type
-
Dialog.type
Members list
Type members
Classlikes
A positioning policy that centers the dialog onscreen. An alternative to RelativeTo.
The positioning policy of an input dialog. Used with the methods on Dialog.
The positioning policy of an input dialog. Used with the methods on Dialog.
Attributes
- See also
- Supertypes
- Known subtypes
-
object Centered.typeclass RelativeTo
A positioning policy that places the dialog near another Swing component. An alternative to Centered.
Value members
Concrete methods
Displays a textual message in a Swing dialog.
Displays a textual message in a Swing dialog.
Parameters
- message
-
a message to the end user
- position
-
the location of the dialog onscreen
Attributes
Asks the user to input a decimal number by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives text interpretable as a Double
or the user cancels.
Asks the user to input a decimal number by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives text interpretable as a Double
or the user cancels.
Parameters
- position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the user input, converted from the textual input with
toDouble
;None
if the user cancelled
Asks the user to input an integer by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives text interpretable as a Double
or the user cancels.
Asks the user to input an integer by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives text interpretable as a Double
or the user cancels.
Parameters
- errorMessage
-
a prefix added to
prompt
on each request except the first - position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the user input, converted from the textual input with
toInt
;None
if the user cancelled
Asks the user to input a line of text via a Swing dialog; accepts any string as input.
Asks the user to input a line of text via a Swing dialog; accepts any string as input.
Parameters
- position
-
the location of the dialog onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the string entered by the user;
None
if they cancelled
Asks the user to choose among the given options via a Swing dialog.
Asks the user to choose among the given options via a Swing dialog.
Parameters
- options
-
any objects that the user will choose one of; their
toString
s will show in the input dialog - position
-
the location of the dialog onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
one of the
options
as chosen by the user;None
if the user cancelled
Asks the user to input a decimal number by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(inputString.toDouble)
returns false
or fails with an exception.
Asks the user to input a decimal number by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(inputString.toDouble)
returns false
or fails with an exception.
Parameters
- errorMessage
-
a prefix added to
prompt
on each request except the first - isOK
-
a function applied to any actual
Double
input to check if it’s valid - position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the user input, converted from the textual input with
toDouble
;None
if the user cancelled
Asks the user to input a line of text via a Swing dialog and interprets the input with the given functions. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(convert(input))
returns false
or fails with an exception.
Asks the user to input a line of text via a Swing dialog and interprets the input with the given functions. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(convert(input))
returns false
or fails with an exception.
Type parameters
- Input
-
the type of the user input (converted from a string to this type)
Parameters
- convert
-
a function applied to the input string to produce the actual return value
- errorMessage
-
a prefix added to
prompt
on each request except the first - isOK
-
a function applied to the input string to check if it’s valid
- position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
a valid user input (converted from a string);
None
if the user cancelled
Asks the user to input an integer by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(inputString.toInt)
returns false
or fails with an exception.
Asks the user to input an integer by typing it in a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(inputString.toInt)
returns false
or fails with an exception.
Parameters
- errorMessage
-
a prefix added to
prompt
on each request except the first - isOK
-
a function applied to any actual integer input to check if it’s valid
- position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the user input, converted from the textual input with
toInt
;None
if the user cancelled
Asks the user to input a non-empty line of text via a Swing dialog. Keeps prompting the user with new dialogs until it receives a non-empty string as input or the user cancels.
Asks the user to input a non-empty line of text via a Swing dialog. Keeps prompting the user with new dialogs until it receives a non-empty string as input or the user cancels.
Parameters
- errorMessage
-
a prefix added to
prompt
on each request except the first - position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
the user input, a non-empty string;
None
if the user cancelled
Asks the user to input a line of text via a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(input.trim)
returns false
or fails with an exception.
Asks the user to input a line of text via a Swing dialog. Keeps prompting the user with new dialogs until it receives a valid input or the user cancels. An input is invalid if isOK(input.trim)
returns false
or fails with an exception.
Parameters
- errorMessage
-
a prefix added to
prompt
on each request except the first - isOK
-
a function applied to the input string to check if it’s valid
- position
-
the location of the dialog(s) onscreen
- prompt
-
a message that prompts the user for input
Attributes
- Returns
-
a valid user input, trimmed for whitespce;
None
if the user cancelled