Spec-Zone.ru › OpenJavaFX 8
javafx.scene.control

Class ChoiceDialog<T>

java.lang.Object
  • javafx.scene.control.Dialog<T>
    • javafx.scene.control.ChoiceDialog<T>

Type Parameters:

T - The type of the items to show to the user, and the type that is returned via Dialog.getResult() when the dialog is dismissed.

All Implemented Interfaces:

EventTarget



public class ChoiceDialog<T>
extends Dialog<T>
A dialog that shows a list of choices to the user, from which they can pick one item at most.

Since:

JavaFX 8u40

See Also:

Dialog

  • Property Summary

    All MethodsInstance MethodsConcrete Methods
    Type Property and Description
    ReadOnlyObjectProperty<T> selectedItem
    Returns the property representing the currently selected item in the dialog.
    • Properties inherited from class javafx.scene.control.Dialog

      contentText, dialogPane, graphic, headerText, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, resizable, resultConverter, result, showing, title, width, x, y
  • Constructor Summary

    Constructors
    Constructor and Description
    ChoiceDialog()
    Creates a default, empty instance of ChoiceDialog with no set items and a null default choice.
    ChoiceDialog(T defaultChoice, Collection<T> choices)
    Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and the second argument specifying a collection of all available choices for the user.
    ChoiceDialog(T defaultChoice, T... choices)
    Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and all following arguments considered a varargs array of all available choices for the user.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    T getDefaultChoice()
    Returns the default choice that was specified in the constructor.
    ObservableList<T> getItems()
    Returns the list of all items that will be displayed to users.
    T getSelectedItem()
    Returns the currently selected item in the dialog.
    ReadOnlyObjectProperty<T> selectedItemProperty()
    Returns the property representing the currently selected item in the dialog.
    void setSelectedItem(T item)
    Sets the currently selected item in the dialog.
    • Methods inherited from class javafx.scene.control.Dialog

      buildEventDispatchChain, close, contentTextProperty, dialogPaneProperty, getContentText, getDialogPane, getGraphic, getHeaderText, getHeight, getModality, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOwner, getResult, getResultConverter, getTitle, getWidth, getX, getY, graphicProperty, headerTextProperty, heightProperty, hide, initModality, initOwner, initStyle, isResizable, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, resizableProperty, resultConverterProperty, resultProperty, setContentText, setDialogPane, setGraphic, setHeaderText, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setResizable, setResult, setResultConverter, setTitle, setWidth, setX, setY, show, showAndWait, showingProperty, titleProperty, widthProperty, xProperty, yProperty
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Detail

    • selectedItem

      public final ReadOnlyObjectProperty<T> selectedItemProperty
      Returns the property representing the currently selected item in the dialog.

      See Also:

      getSelectedItem(), setSelectedItem(T)

  • Constructor Detail

    • ChoiceDialog

      public ChoiceDialog()
      Creates a default, empty instance of ChoiceDialog with no set items and a null default choice. Users of this constructor will subsequently need to call getItems() to specify which items to show to the user.
    • ChoiceDialog

      public ChoiceDialog(T defaultChoice,
                          T... choices)
      Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and all following arguments considered a varargs array of all available choices for the user. It is expected that the defaultChoice be one of the elements in the choices varargs array. If this is not true, then defaultChoice will be set to null and the dialog will show with the initial choice set to the first item in the list of choices.

      Parameters:

      defaultChoice - The item to display as the pre-selected choice in the dialog. This item must be contained within the choices varargs array.

    • ChoiceDialog

      public ChoiceDialog(T defaultChoice,
                          Collection<T> choices)
      Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and the second argument specifying a collection of all available choices for the user. It is expected that the defaultChoice be one of the elements in the choices collection. If this is not true, then defaultChoice will be set to null and the dialog will show with the initial choice set to the first item in the list of choices.

      Parameters:

      defaultChoice - The item to display as the pre-selected choice in the dialog. This item must be contained within the choices varargs array.

  • Method Detail

    • getSelectedItem

      public final T getSelectedItem()
      Returns the currently selected item in the dialog.
    • selectedItemProperty

      public final ReadOnlyObjectProperty<T> selectedItemProperty()
      Returns the property representing the currently selected item in the dialog.

      See Also:

      getSelectedItem(), setSelectedItem(T)

    • setSelectedItem

      public final void setSelectedItem(T item)
      Sets the currently selected item in the dialog.

      Parameters:

      item - The item to select in the dialog.

    • getItems

      public final ObservableList<T> getItems()
      Returns the list of all items that will be displayed to users. This list can be modified by the developer to add, remove, or reorder the items to present to the user.
    • getDefaultChoice

      public final T getDefaultChoice()
      Returns the default choice that was specified in the constructor.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API