class Dialog[R] extends EventTarget with SFXDelegate[javafx.scene.control.Dialog[R]]
A Dialog wraps a DialogPane and provides the necessary API to present it to end users.
Wraps a JavaFX Dialog.
- R
The default return type of the dialog, via the result property or
showAndWait
method.
- Source
- Dialog.scala
- Alphabetic
- By Inheritance
- Dialog
- EventTarget
- SFXDelegate
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Dialog(delegate: javafx.scene.control.Dialog[R] = new jfxsc.Dialog[R]())
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 buildEventDispatchChain(tail: EventDispatchChain): EventDispatchChain
Construct an event dispatch chain for this target.
Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this
EventTarget
. This event target is not automatically added to the chain, so if it wants to process events, it needs to add anEventDispatcher
for itself to the chain.In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.
The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.
The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.
- tail
the initial chain to build from
- returns
the resulting event dispatch chain for this target
- Definition Classes
- EventTarget
- See also
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def contentText: StringProperty
A property representing the content text for the dialog pane.
A property representing the content text for the dialog pane. The content text is lower precedence than the scalafx.scene.control.DialogPane.content node, meaning that if both the content node and the contentText properties are set, the content text will not be displayed in a default DialogPane instance.
- See also
- def contentText_=(value: String): Unit
- val delegate: javafx.scene.control.Dialog[R]
JavaFX object to be wrapped.
JavaFX object to be wrapped.
- Definition Classes
- Dialog → EventTarget → SFXDelegate
- def dialogPane: ObjectProperty[javafx.scene.control.DialogPane]
- def dialogPane_=(value: DialogPane): Unit
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(ref: Any): Boolean
Verifies if a object is equals to this delegate.
Verifies if a object is equals to this delegate.
- ref
Object to be compared.
- returns
if the other object is equals to this delegate or not.
- Definition Classes
- SFXDelegate → AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def graphic: ObjectProperty[javafx.scene.Node]
The dialog graphic, presented either in the header, if one is showing, or to the left of the
content
.The dialog graphic, presented either in the header, if one is showing, or to the left of the
content
.- See also
- def graphic_=(value: Node): Unit
- def hashCode(): Int
- returns
The delegate hashcode
- Definition Classes
- SFXDelegate → AnyRef → Any
- def headerText: StringProperty
A property representing the header text for the dialog pane.
A property representing the header text for the dialog pane. The header text is lower precedence than the scalafx.scene.control.DialogPane.header node, meaning that if both the header node and the headerText properties are set, the header text will not be displayed in a default DialogPane instance.
- See also
- def headerText_=(value: Option[String]): Unit
- def headerText_=(value: String): Unit
- def height: ReadOnlyDoubleProperty
Property representing the height of the dialog.
- def height_=(h: Double): Unit
- def initModality(modality: Modality): Unit
Specifies the modality for this dialog.
Specifies the modality for this dialog. This must be done prior to making the dialog visible. The modality is one of: Modality.NONE, Modality.WINDOW_MODAL, or Modality.APPLICATION_MODAL.
- modality
the modality for this dialog.
- Exceptions thrown
IllegalStateException
if this property is set after the dialog has ever been made visible.
- def initOwner(window: Window): Unit
Specifies the owner Window for this dialog, or null for a top-level, unowned dialog.
Specifies the owner Window for this dialog, or null for a top-level, unowned dialog. This must be done prior to making the dialog visible.
- window
the owner Window for this dialog.
- Exceptions thrown
IllegalStateException
if this property is set after the dialog has ever been made visible.
- def initStyle(style: StageStyle): Unit
Specifies the style for this dialog.
Specifies the style for this dialog. This must be done prior to making the dialog visible. The style is one of: StageStyle.DECORATED, StageStyle.UNDECORATED, StageStyle.TRANSPARENT, StageStyle.UTILITY, or StageStyle.UNIFIED.
- style
the style for this dialog.
- Exceptions thrown
IllegalStateException
if this property is set after the dialog has ever been made visible.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def modality: Modality
Retrieves the modality attribute for this dialog.
Retrieves the modality attribute for this dialog.
- returns
the modality.
- See also
- 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 onCloseRequest: ObjectProperty[EventHandler[javafx.scene.control.DialogEvent]]
- def onCloseRequest_=(v: EventHandler[javafx.scene.control.DialogEvent]): Unit
- def onHidden: ObjectProperty[EventHandler[javafx.scene.control.DialogEvent]]
Called just after the Dialog has been hidden.
Called just after the Dialog has been hidden. When the scalafx.scene.control.Dialog is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the scalafx.scene.control.Dialog is closed.
- def onHidden_=(v: EventHandler[javafx.scene.control.DialogEvent]): Unit
- def onHiding: ObjectProperty[EventHandler[javafx.scene.control.DialogEvent]]
Called just prior to the Dialog being hidden.
- def onHiding_=(v: EventHandler[javafx.scene.control.DialogEvent]): Unit
- def onShowing: ObjectProperty[EventHandler[javafx.scene.control.DialogEvent]]
Called just prior to the Dialog being shown.
- def onShowing_=(v: EventHandler[javafx.scene.control.DialogEvent]): Unit
- def onShown: ObjectProperty[EventHandler[javafx.scene.control.DialogEvent]]
Called just after the Dialog is shown.
- def onShown_=(v: EventHandler[javafx.scene.control.DialogEvent]): Unit
- def owner: Window
Retrieves the owner Window for this dialog, or null for an unowned dialog.
Retrieves the owner Window for this dialog, or null for an unowned dialog.
- returns
the owner Window.
- See also
- def resizable: BooleanProperty
Represents whether the dialog is resizable.
- def resizable_=(v: Boolean): Unit
- def result: ObjectProperty[R]
A property representing what has been returned from the dialog.
A property representing what has been returned from the dialog. A result is generated through the
resultConverter
, which is intended to convert from theButtonType
that the user clicked on into a value of type R.- See also
- def resultConverter: ObjectProperty[(ButtonType) => R]
API to convert the scalafx.scene.control.ButtonType that the user clicked on into a result that can be returned via the scalafx.scene.control.Dialog.result property.
API to convert the scalafx.scene.control.ButtonType that the user clicked on into a result that can be returned via the scalafx.scene.control.Dialog.result property. This is necessary as scalafx.scene.control.ButtonType represents the visual button within the dialog, and do not know how to map themselves to a valid result - that is a requirement of the dialog implementation by making use of the result converter. In some cases, the result type of a Dialog subclass is ButtonType (which means that the result converter can be null), but in some cases (where the result type, R, is not ButtonType or Void), this callback must be specified.
- def resultConverter_=(f: (ButtonType) => R): Unit
- def result_=(value: R): Unit
- def showAndWait[F](j2s: F = (x: R) => x)(implicit convert: DConvert[R, F]): Option[S]
Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).
Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).
The intended use when return value is ignored:
dialog.showAndWait()
Or when return value is required:
val r = dialog.showAndWait() r match { case Some(v) => ... case None => ... }
- returns
An
Option
that contains theresult
.
- See also
- def showing: ReadOnlyBooleanProperty
Represents whether the dialog is currently showing.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def title: StringProperty
Return the title of the dialog.
- def title_=(v: String): Unit
- def toString(): String
- returns
Returns the original delegate's
toString()
adding a[SFX]
prefix.
- Definition Classes
- SFXDelegate → 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])
- def width: ReadOnlyDoubleProperty
Property representing the width of the dialog.
- def width_=(w: Double): Unit
- def x: ReadOnlyDoubleProperty
The horizontal location of this scalafx.scene.control.Dialog.
The horizontal location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog horizontally.
- def x_=(v: Double): Unit
- def y: ReadOnlyDoubleProperty
The vertical location of this scalafx.scene.control.Dialog.
The vertical location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog vertically.
- def y_=(v: Double): Unit
ScalaFX is a UI DSL written within the Scala Language that sits on top of JavaFX 2.x and and JavaFX 8. This means that every ScalaFX application is also a valid Scala application. By extension it supports full interoperability with Java and can run anywhere the Java Virtual Machine (JVM) and JavaFX 2.0 or JavaFX 8 are supported.
Package Structure
ScalaFX package structure corresponds to JavaFX package structure, for instance
scalafx.animation
corresponds tojavafx.animation
.Example Usage
A basic ScalaFX application is created creating an object that is an instance of
JFXApp
. Following Java FX theatre metaphor, it contains astage
that contains ascene
. Astage
roughly corresponds to a window in a typical UI environment. Thescene
holds UI content presented to the user. In the example below, the content is a pane with a singlelabel
component.