Set Items Selected in a CheckComboBox

僤鯓⒐⒋嵵緔 提交于 2019-12-11 04:03:37

问题


I´m using the CheckComboBox by ControlsFX for a Project and I want to set some of the Items Checked from the Start so I tried this Code in my initialize-Methode, but when i start the program, nothing is set Selected/Checked.

checkBox.getCheckedModel.check(1);

I´m using an ObservableList of Strings for the Box and got it build into my FXML file and everything works fine, but the CheckModel-thing refuses to work.

Thanks in advance!


回答1:


Hi you can try use the folllowing

CheckComboBox.getCheckModel().checkIndices(int...args);
CheckComboBox.getCheckModel().check(int);
CheckComboBox.getCheckModel().check(String);

These work for me



来源:https://stackoverflow.com/questions/27890237/set-items-selected-in-a-checkcombobox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!