ComboBox FXML default value

前端 未结 3 1970
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 04:20

How can I set a default value in a ComboBox using FXML?



        
3条回答
  •  伪装坚强ぢ
    2021-02-04 04:39

    I got a strange error with the first suggested method

    setSelectedItem(T) has protected access in SelectionModel where T is a type-variable: T extends Object declared in class SelectionModel

    For me

    getSelectionModel().select("NVT");
    

    worked like a charm.

提交回复
热议问题