I'm writing a messenger in Java and FXML and I want to show all the current chats of the user on a ListView
(chatBar). My chats are in an ObservableArrayList
but I still can't add the values to the ListView
.
public void fillChatBar() {
ArrayList<Chat> chats = db.getAllInvolvedChats(user.getUserID());
ObservableList<Pane> chatHolder = FXCollections.observableArrayList();
chats.forEach(chat -> {
Pane chatPane = new Pane();
Label chatName = new Label();
chatName.setText(chat.getOpponent(user.getUserID()).getUsername());
chatPane.getChildren().add(chatName);
chatPane.getChildren().add(new ImageView(chat.getOpponent(user.getUserID()).getProfileImage()));
chatHolder.add(chatPane);
});
chatBar.setItems(chatHolder);
}
I get no error messages or exceptions. It just won't show.