Date Published:
Last Modified:

Creating A List View In FXML

Although this would not be the standard way to do it (normally a ListView would be populated by the backend Java code), you can create a ListView node using pure fxml code:

        <FXCollections fx:factory="observableArrayList">
            <String fx:value="One"/>
            <String fx:value="Two"/>
            <String fx:value="Three"/>
            <String fx:value="Four"/>
            <String fx:value="Five"/>

Note that is important to wrap the String objects inside a ObservableArrayList object.


    comments powered by Disqus