I'm trying to display a ListView but it does not work. Here is where the variable where the data I want to display is initialized :
public static ListView<String> usersList = new ListView<String>();
Here is where it is supposed to be displayed :
<listView fx:id="usersList" prefHeight="307.0" prefWidth="306.0" />
Here is where the FXML file is stocked :
root = FXMLoader.Load(getClass().getRessource("/View/UsersListWindowFx.fxml"));
And finally, here is where I add elements in usersList :
public void initialize(URL location, RessourceBundle ressources) {
List<String> usersListData = UserDataBase.getAllActiveUsersUsername();
ObservableList<String> names = FXCollections.observableArrayList(usersListData);
usersList.setItems(names);
}
I already check, UserDataBase.getAllActiveUsersUsername()
does not return an empty list and there is various String in it, but despite that usersList still does not display.
Please, do you have any idea of what could cause this problem ?