Load data from an ArrayList to a ListView in IntelliJ using JavaFX

Tiempo de lectura: 2 minutos

Reading time: 2 minutes

First, we need to have a designed FXML FILE where we add a ListView element with its id. In this case, we call it “listaAplicaciones”.

In the corresponding Java Class, we reference the created ListView and create an ArrayList with the data we want to display as follows:

In order to load the data from the ArrayList into the ListView very easily, we call the ListView by its id. Following this example, it would be “listaAplicaciones”, and we add all the items from “listaApps”.

Once the data is collected, it will be displayed in the ListView when the application is executed or launched.

We verify the result by following the previous steps.

Leave a Comment