java - ComboBox Items via Scene Builder? -
<combobox fx:id="schaltung" layoutx="347.0" layouty="50.0" prefheight="63.0" prefwidth="213.0"> <items> <fxcollections fx:factory="observablearraylist"> <string fx:id="reihe" fx:value="reihenschaltung" /> <string fx:id="parallel" fx:value="parallelschaltung" /> </fxcollections> </items> </combobox>
i added fxml file because couldnt figure out add items combobox in scenebuilder. possible add items via scenebuilder, or have manually?
you can't add items combobox through scenebuilder. either can add through fxml file did or through controller given below.
@override public void initialize(url location, resourcebundle resources) { combobox.getitems().removeall(combobox.getitems()); combobox.getitems().addall("option a", "option b", "option c"); combobox.getselectionmodel().select("option b"); }
Comments
Post a Comment