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.public class ChoiceDialog<T> extends Dialog<T>
Dialog
Type | Property and Description |
---|---|
ReadOnlyObjectProperty<T> |
selectedItem
Returns the property representing the currently selected item in the dialog.
|
contentText, dialogPane, graphic, headerText, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, resizable, resultConverter, result, showing, title, width, x, y
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.
|
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.
|
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
public final ReadOnlyObjectProperty<T> selectedItemProperty
getSelectedItem()
,
setSelectedItem(T)
public ChoiceDialog()
getItems()
to specify which items to show to the user.public ChoiceDialog(T defaultChoice, T... choices)
defaultChoice
- The item to display as the pre-selected choice in the dialog.
This item must be contained within the choices varargs array.choices
- All possible choices to present to the user.public ChoiceDialog(T defaultChoice, Collection<T> choices)
defaultChoice
- The item to display as the pre-selected choice in the dialog.
This item must be contained within the choices varargs array.choices
- All possible choices to present to the user.public final T getSelectedItem()
public final ReadOnlyObjectProperty<T> selectedItemProperty()
getSelectedItem()
,
setSelectedItem(T)
public final void setSelectedItem(T item)
item
- The item to select in the dialog.public final ObservableList<T> getItems()
public final T getDefaultChoice()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.