Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ChoiceDialog

[14:7] extends: Dialog

Wraps JavaFX ChoiceDialog, a dialog that lets the user select one item from a list of choices and returns the selected item. A default choice is shown pre-selected when the dialog opens. Title, header text, and content text can be set to provide context. Call showAndWait() to block until the user confirms or cancels, then inspect the returned value for the chosen item.

Methods

  • ChoiceDialog (DefaultChoice, list Choices)

    Creates a new ChoiceDialog with a default choice and a list of options.

    • @p DefaultChoice is the initially selected value.
    • @p Choices is a list of choice values.
  • getDefaultChoice ()

    Returns the default choice that was passed at construction.

    • @r The default choice value.
  • getItems ()

    Returns the live ObservableList of available items. Mutations to the returned list update the dialog combo box.

    • @r An ObservableList AJO of items.
  • getSelectedItem ()

    Returns the currently selected item.

    • @r The selected value.
  • setSelectedItem (Val)

    Sets the currently selected item.

    • @p Val is the value to select.
    • @r this object for chaining
  • selectedItemProperty ()

    Returns the read-only property reporting the selected item.

    • @r A ReadOnlyObjectProperty AJO around the selected item.