如何在comboBox javafx中设置默认值?

She*_* Fn 16 java javafx

我需要设置为默认值ComboBoxObservableArrayList,我想在我的设置第一个值ArrayList作为默认值.

List = FXCollections.observableArrayList(arrayList);
comboBox.setItems(List);
Run Code Online (Sandbox Code Playgroud)

Ulu*_*Biy 36

comboBox.getSelectionModel().selectFirst();
Run Code Online (Sandbox Code Playgroud)


sim*_*ser 11

comboBox.getSelectionModel().select(index);
Run Code Online (Sandbox Code Playgroud)

其中index整数位置的项目中选择模型来选择,或者一个从相同类型该ArrayList和.