Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Dialog

[23:7] extends: FxObj

The Dialog class wraps javafx.scene.control.Dialog, the base class for the JavaFX pop-up dialogs (Alert, TextInputDialog, ChoiceDialog). It owns a DialogPane and provides the shared title, header, content, graphic, sizing, window, and show/hide behavior that every dialog inherits. This wrapper is not constructed directly. Concrete dialog subclasses extend it, mirroring the JavaFX inheritance model, and set this.obj in their own constructors. The event handler and filter methods (addEventHandler, addEventFilter, removeEventHandler, removeEventFilter) are wrapped below; they take an EventType obtained with fx.eventType(...), for example fx.eventType(fxevent.DIALOG_SHOWING). Dialog does not expose fireEvent, and the buildEventDispatchChain routing internal is intentionally not wrapped.

Methods

  • Dialog ()

    Base constructor. Dialog is abstract in practice and is never instantiated on its own.

  • setTitle (string Title)

    Sets the dialog window title.

    • @p Title is a string with the title text.
    • @r this object for chaining
  • getTitle ()

    Returns the dialog window title.

    • @r A string with the title text.
  • titleProperty ()

    Returns the StringProperty backing the title.

    • @r An AJO wrapping javafx.beans.property.StringProperty.
  • setHeaderText (string Text)

    Sets the header text shown above the content.

    • @p Text is a string with the header text.
    • @r this object for chaining
  • getHeaderText ()

    Returns the header text.

    • @r A string with the header text, or null when none is set.
  • headerTextProperty ()

    Returns the StringProperty backing the header text.

    • @r An AJO wrapping javafx.beans.property.StringProperty.
  • setContentText (string Text)

    Sets the main content text of the dialog.

    • @p Text is a string with the content text.
    • @r this object for chaining
  • getContentText ()

    Returns the main content text of the dialog.

    • @r A string with the content text.
  • contentTextProperty ()

    Returns the StringProperty backing the content text.

    • @r An AJO wrapping javafx.beans.property.StringProperty.
  • setGraphic (object GraphicNode = null)

    Sets a graphic node shown in the dialog header area.

    • @p GraphicNode is a Node wrapper, or null to clear.
    • @r this object for chaining
  • getGraphic ()

    Returns the header graphic node.

    • @r An AJO wrapping javafx.scene.Node, or null when none is set.
  • graphicProperty ()

    Returns the ObjectProperty backing the graphic.

    • @r An AJO wrapping ObjectProperty.
  • getDialogPane ()

    Returns the DialogPane that holds the dialog layout and buttons.

    • @r An AJO wrapping javafx.scene.control.DialogPane.
  • setDialogPane (Pane)

    Sets the DialogPane for this dialog.

    • @p Pane is a DialogPane wrapper or a raw AJO.
    • @r this object for chaining
  • dialogPaneProperty ()

    Returns the ObjectProperty backing the DialogPane.

    • @r An AJO wrapping ObjectProperty.
  • getResult ()

    Returns the result produced by the dialog after it is closed.

    • @r An AJO or value with the dialog result, or null.
  • setResult (Value)

    Sets the dialog result value. Accepts a primitive, a raw AJO, or null.

    • @p Value is the result value to store.
    • @r this object for chaining
  • resultProperty ()

    Returns the ObjectProperty backing the result.

    • @r An AJO wrapping ObjectProperty.
  • show ()

    Shows the dialog without blocking the caller.

    • @r this object for chaining
  • showAndWait ()

    Shows the dialog and blocks until the user closes it.

    • @r An AJO wrapping the Optional result of the dialog.
  • hide ()

    Hides the dialog.

    • @r this object for chaining
  • close ()

    Closes the dialog.

    • @r this object for chaining
  • isShowing ()

    Returns whether the dialog is currently showing.

    • @r A bool that is true while the dialog is visible.
  • showingProperty ()

    Returns the ReadOnlyBooleanProperty backing the showing state.

    • @r An AJO wrapping ReadOnlyBooleanProperty.
  • setResizable (bool Resizable)

    Sets whether the user can resize the dialog window.

    • @p Resizable is a bool; true allows resizing.
    • @r this object for chaining
  • isResizable ()

    Returns whether the dialog window is resizable.

    • @r A bool that is true when resizing is allowed.
  • resizableProperty ()

    Returns the BooleanProperty backing the resizable flag.

    • @r An AJO wrapping javafx.beans.property.BooleanProperty.
  • setWidth (double W)

    Sets the dialog window width in pixels.

    • @p W is a double with the width.
    • @r this object for chaining
  • getWidth ()

    Returns the dialog window width in pixels.

    • @r A double with the width.
  • widthProperty ()

    Returns the ReadOnlyDoubleProperty backing the width.

    • @r An AJO wrapping ReadOnlyDoubleProperty.
  • setHeight (double H)

    Sets the dialog window height in pixels.

    • @p H is a double with the height.
    • @r this object for chaining
  • getHeight ()

    Returns the dialog window height in pixels.

    • @r A double with the height.
  • heightProperty ()

    Returns the ReadOnlyDoubleProperty backing the height.

    • @r An AJO wrapping ReadOnlyDoubleProperty.
  • setX (double X)

    Sets the dialog window x position on screen, in pixels.

    • @p X is a double with the x coordinate.
    • @r this object for chaining
  • getX ()

    Returns the dialog window x position on screen, in pixels.

    • @r A double with the x coordinate.
  • xProperty ()

    Returns the ReadOnlyDoubleProperty backing the x position.

    • @r An AJO wrapping ReadOnlyDoubleProperty.
  • setY (double Y)

    Sets the dialog window y position on screen, in pixels.

    • @p Y is a double with the y coordinate.
    • @r this object for chaining
  • getY ()

    Returns the dialog window y position on screen, in pixels.

    • @r A double with the y coordinate.
  • yProperty ()

    Returns the ReadOnlyDoubleProperty backing the y position.

    • @r An AJO wrapping ReadOnlyDoubleProperty.
  • initModality (string ModalityName)

    Sets the dialog modality. Must be called before the dialog is shown.

    • @p ModalityName is a javafx.stage.Modality constant name: NONE, WINDOW_MODAL, or APPLICATION_MODAL.
    • @r this object for chaining
  • getModality ()

    Returns the dialog modality.

    • @r An AJO wrapping javafx.stage.Modality.
  • initStyle (string StyleName)

    Sets the dialog window style. Must be called before the dialog is shown.

    • @p StyleName is a javafx.stage.StageStyle constant name: DECORATED, UNDECORATED, TRANSPARENT, UTILITY, or UNIFIED.
    • @r this object for chaining
  • initOwner (OwnerWindow = null)

    Sets the owner window for this dialog. Must be called before the dialog is shown.

    • @p OwnerWindow is a Window wrapper or a raw AJO, or null for no owner.
    • @r this object for chaining
  • getOwner ()

    Returns the owner window of this dialog.

    • @r An AJO wrapping javafx.stage.Window, or null when there is no owner.
  • setOnShowing (callback Cb)

    Registers a callback invoked just before the dialog is shown.

    • @p Cb is a callback invoked with a DialogEvent.
    • @r this object for chaining
  • getOnShowing ()

    Returns the onShowing handler.

    • @r An AJO wrapping javafx.event.EventHandler, or null.
  • onShowingProperty ()

    Returns the ObjectProperty backing the onShowing handler.

    • @r An AJO wrapping ObjectProperty.
  • setOnShown (callback Cb)

    Registers a callback invoked just after the dialog is shown.

    • @p Cb is a callback invoked with a DialogEvent.
    • @r this object for chaining
  • getOnShown ()

    Returns the onShown handler.

    • @r An AJO wrapping javafx.event.EventHandler, or null.
  • onShownProperty ()

    Returns the ObjectProperty backing the onShown handler.

    • @r An AJO wrapping ObjectProperty.
  • setOnHiding (callback Cb)

    Registers a callback invoked just before the dialog is hidden.

    • @p Cb is a callback invoked with a DialogEvent.
    • @r this object for chaining
  • getOnHiding ()

    Returns the onHiding handler.

    • @r An AJO wrapping javafx.event.EventHandler, or null.
  • onHidingProperty ()

    Returns the ObjectProperty backing the onHiding handler.

    • @r An AJO wrapping ObjectProperty.
  • setOnHidden (callback Cb)

    Registers a callback invoked just after the dialog is hidden.

    • @p Cb is a callback invoked with a DialogEvent.
    • @r this object for chaining
  • getOnHidden ()

    Returns the onHidden handler.

    • @r An AJO wrapping javafx.event.EventHandler, or null.
  • onHiddenProperty ()

    Returns the ObjectProperty backing the onHidden handler.

    • @r An AJO wrapping ObjectProperty.
  • setOnCloseRequest (callback Cb)

    Registers a callback invoked when the dialog receives a close request.

    • @p Cb is a callback invoked with a DialogEvent.
    • @r this object for chaining
  • getOnCloseRequest ()

    Returns the onCloseRequest handler.

    • @r An AJO wrapping javafx.event.EventHandler, or null.
  • onCloseRequestProperty ()

    Returns the ObjectProperty backing the onCloseRequest handler.

    • @r An AJO wrapping ObjectProperty.
  • setResultConverter (callback Cb)

    Registers a converter that turns the clicked button into the dialog result.

    • @p Cb is a callback invoked with the ButtonType, returning the result.
    • @r this object for chaining
  • getResultConverter ()

    Returns the result converter callback.

    • @r An AJO wrapping javafx.util.Callback, or null.
  • resultConverterProperty ()

    Returns the ObjectProperty backing the result converter.

    • @r An AJO wrapping ObjectProperty.
  • addEventHandler (object EventTypeObj, callback Cb)

    Adds an event handler for the given event type. The handler fires in the bubbling phase, and multiple handlers may be registered for one type.

    • @p EventTypeObj is an event type, obtained from fx.eventType(...), for example fx.eventType(fxevent.DIALOG_SHOWING).
    • @p Cb is a callback that receives the event.
    • @r A handler reference. Keep it if you intend to remove the handler later with removeEventHandler; otherwise it can be ignored.
  • removeEventHandler (object EventTypeObj, object Handler)

    Removes a handler previously added with addEventHandler. JavaFX matches by identity, so pass the handler reference that addEventHandler returned.

    • @p EventTypeObj is an event type, obtained from fx.eventType(...).
    • @p Handler is the handler reference returned by addEventHandler.
    • @r this object for chaining
  • addEventFilter (object EventTypeObj, callback Cb)

    Adds an event filter for the given event type. Filters fire in the capturing phase, before handlers, so a filter can inspect or consume an event before it reaches its target.

    • @p EventTypeObj is an event type, obtained from fx.eventType(...).
    • @p Cb is a callback that receives the event.
    • @r A filter reference. Keep it if you intend to remove the filter later with removeEventFilter; otherwise it can be ignored.
  • removeEventFilter (object EventTypeObj, object Handler)

    Removes a filter previously added with addEventFilter. Pass the filter reference that addEventFilter returned.

    • @p EventTypeObj is an event type, obtained from fx.eventType(...).
    • @p Handler is the filter reference returned by addEventFilter.
    • @r this object for chaining