设置在CheckComboBox中选择的项目 [英] Set Items Selected in a CheckComboBox

查看:476
本文介绍了设置在CheckComboBox中选择的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ControlsFX的CheckComboBox进行项目,并且我希望从开始设置一些已检查的项目,所以我在initialize-Methode中尝试了此代码,但是当我启动程序时,未设置任何内容Selected/已检查.

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);

我正在为Box使用一个ObservableList of Strings,并将其构建到我的FXML文件中,并且一切正常,但是CheckModel不能正常工作.

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.

提前谢谢!

推荐答案

您可以尝试使用以下方法

Hi you can try use the folllowing

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

这些对我有用

这篇关于设置在CheckComboBox中选择的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆