to add elements to a ChoiceBox , in JavaFx , we use add () methods or addAll () . Now if I have a ChoiceBox with a series of elements, how did he replace them with others? Is there a direct method other than cleaning the content and adding a new one?
// create the choice box with some items
ChoiceBox cb = new ChoiceBox(
FXCollections.observableArrayList("uno", "dos"));
// clean ChoiceBox items
cb.getItems().clear();
// add new ChoiceBox items
cb.getItems().addAll(
FXCollections.observableArrayList("nuevo", "otro", "xxx"));