【发布时间】:2017-06-04 12:39:07
【问题描述】:
我想将一个集合绑定到 FXML 中的多个 ChoiceBox。 但是我知道如何使用的唯一方法是:
<ChoiceBox fx:id="cb00" prefWidth="150.0" GridPane.rowIndex="0" GridPane.columnIndex="0">
<items>
<FXCollections fx:id="test" fx:factory="observableArrayList">
<String fx:value="1" />
<String fx:value="2" />
<String fx:value="3" />
<String fx:value="4" />
<String fx:value="5" />
<String fx:value="6" />
<String fx:value="7" />
<String fx:value="8" />
<String fx:value="9" />
</FXCollections>
</items>
</ChoiceBox>
是否可以在控制器中声明集合并在FXML中引用它而不是为每个ChoiceBox复制集合?
【问题讨论】:
标签: java javafx collections fxml