Reputation: 1571
I need to set a default value for a ComboBox
from an ObservableArrayList
, I am trying to set the first value in my ArrayList
as a default value.
List = FXCollections.observableArrayList(arrayList);
comboBox.setItems(List);
Upvotes: 26
Views: 66310
Reputation: 11
comboBox.getSelectionModel().clearSelection();
I was just looking for a way to leave it in the same way I had started with, in my case with an introductory text
Upvotes: 1
Reputation: 1682
comboBox.getSelectionModel().select(index);
where index
is the integer position of the item to select in the selection model, or a value from and of the same type as the arrayList.
Upvotes: 25