Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
约束观察者<;复选框>;到HBox';JavaFX中的儿童?_Java_Javafx - Fatal编程技术网

约束观察者<;复选框>;到HBox';JavaFX中的儿童?

约束观察者<;复选框>;到HBox';JavaFX中的儿童?,java,javafx,Java,Javafx,我希望能够做一些事情,比如: ObservableList<CheckBox> checkboxes = ...; HBox hbox = new HBox(); hbox.childrenProperty.bind(checkboxes); observeList复选框=。。。; HBox HBox=新的HBox(); hbox.childrenProperty.bind(复选框); 但似乎没有childrenProperty。是否有可能以某种方式(简单且惯用的方式)将HBox

我希望能够做一些事情,比如:

ObservableList<CheckBox> checkboxes = ...;
HBox hbox = new HBox();
hbox.childrenProperty.bind(checkboxes);
observeList复选框=。。。;
HBox HBox=新的HBox();
hbox.childrenProperty.bind(复选框);
但似乎没有
childrenProperty
。是否有可能以某种方式(简单且惯用的方式)将HBox(或任何其他布局)的元素绑定到ObservableList

我试图“解决”的问题是不必在视图上有这种逻辑——我想进行这种映射,这样我就可以将视图控件映射到ViewModel的属性/绑定,并将所有逻辑保持在该级别


谢谢

经过反复思考,我终于找到了一种方法:

ObservableList<CheckBox> checkboxes = ...;
Bindings.bindContent(hbox.getChildren(), checkboxes);
observeList复选框=。。。;
Bindings.bindContent(hbox.getChildren(),复选框);

使用监听器进行绑定怎么样:
复选框。addListener((ListChangeListener.change)并自己实现所有更新逻辑?我期待更高层次的东西。