object Dialog
This object provides convenience methods for displaying messages and reading user input via simple Swing dialogs.
- Alphabetic
- By Inheritance
- Dialog
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait Position extends Product with Serializable
Represents the positioning policy of an input dialog.
Represents the positioning policy of an input dialog. Used with the methods on Dialog. @see RelativeTo, Centered
- final case class RelativeTo(locator: Component) extends Position with Product with Serializable
A positioning policy that places the dialog near another Swing component.
A positioning policy that places the dialog near another Swing component. An alternative to Centered.
- locator
the Swing component in front of which the Dialog should appear
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def display(message: String, position: Position): Unit
Displays a textual message in a Swing dialog.
Displays a textual message in a Swing dialog.
- message
a message to the end user
- position
the location of the dialog onscreen
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def requestAnyDouble(prompt: String, position: Position): Option[Double]
Asks the user to input a decimal number by typing it in a Swing dialog.
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.- prompt
a message that prompts the user for input
- position
the location of the dialog(s) onscreen
- returns
the user input, converted from the textual input with
toDouble
;None
if the user cancelled
- def requestAnyInt(prompt: String, errorMessage: String, position: Position): Option[Int]
Asks the user to input an integer by typing it in a Swing dialog.
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.- prompt
a message that prompts the user for input
- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
the user input, converted from the textual input with
toInt
;None
if the user cancelled
- def requestAnyLine(prompt: String, position: Position): Option[String]
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.
- prompt
a message that prompts the user for input
- position
the location of the dialog onscreen
- returns
the string entered by the user;
None
if they cancelled
- def requestChoice[Choice](prompt: String, options: Seq[Choice], position: Position): Option[Choice]
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.
- prompt
a message that prompts the user for input
- 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
- returns
one of the
options
as chosen by the user;None
if the user cancelled
- def requestDouble(prompt: String, isOK: (Double) => Boolean, errorMessage: String, position: Position): Option[Double]
Asks the user to input a decimal number by typing it in a Swing dialog.
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)
returnsfalse
or fails with an exception.- prompt
a message that prompts the user for input
- isOK
a function applied to any actual
Double
input to check if it’s valid- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
the user input, converted from the textual input with
toDouble
;None
if the user cancelled
- def requestInput[Input](prompt: String, convert: (String) => Input, isOK: (Input) => Boolean, errorMessage: String, position: Position): Option[Input]
Asks the user to input a line of text via a Swing dialog and interprets the input with the given functions.
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))
returnsfalse
or fails with an exception.- Input
the type of the user input (converted from a string to this type)
- prompt
a message that prompts the user for input
- convert
a function applied to the input string to produce the actual return value
- isOK
a function applied to the input string to check if it’s valid
- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
a valid user input (converted from a string);
None
if the user cancelled
- def requestInt(prompt: String, isOK: (Int) => Boolean, errorMessage: String, position: Position): Option[Int]
Asks the user to input an integer by typing it in a Swing dialog.
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)
returnsfalse
or fails with an exception.- prompt
a message that prompts the user for input
- isOK
a function applied to any actual integer input to check if it’s valid
- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
the user input, converted from the textual input with
toInt
;None
if the user cancelled
- def requestNonEmptyLine(prompt: String, errorMessage: String, position: Position): Option[String]
Asks the user to input a non-empty line of text via a Swing dialog.
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.
- prompt
a message that prompts the user for input
- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
the user input, a non-empty string;
None
if the user cancelled
- def requestString(prompt: String, isOK: (String) => Boolean, errorMessage: String, position: Position): Option[String]
Asks the user to input a line of text via a Swing dialog.
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)
returnsfalse
or fails with an exception.- prompt
a message that prompts the user for input
- isOK
a function applied to the input string to check if it’s valid
- errorMessage
a prefix added to
prompt
on each request except the first- position
the location of the dialog(s) onscreen
- returns
a valid user input, trimmed for whitespce;
None
if the user cancelled
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- object Centered extends Position with Product with Serializable
A positioning policy that centers the dialog onscreen.
A positioning policy that centers the dialog onscreen. An alternative to RelativeTo.
- object RelativeTo extends Product with Serializable
A companion object with factory methods.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.