OP 27 February, 2020 - 12:50 AM
(This post was last modified: 27 February, 2020 - 02:30 AM by Jmatts54.
Edit Reason: Code Update
)
So I'm trying to do an assignment and I can't get my head around some things.
I have 3 options in a ListView, 1 course meal, 2 course meal, 3 course meal.
When I try to populate 3 ListViews with preset lists, after clicking a button, all goes well. When I try to remove the contents of a populated ListView, things work out. But when I try to repopulate a ListView, I can't seem to get the list items to show up. Here is the code excerpt:
Thanks
I have 3 options in a ListView, 1 course meal, 2 course meal, 3 course meal.
When I try to populate 3 ListViews with preset lists, after clicking a button, all goes well. When I try to remove the contents of a populated ListView, things work out. But when I try to repopulate a ListView, I can't seem to get the list items to show up. Here is the code excerpt:
Code:
public void getList(ActionEvent actionEvent) {
int index= chooseCourseListView.getSelectionModel().getSelectedIndex();
StartersListView.setItems(starters);
MainsListView.setItems(mains);
DessertsListView.setItems(desserts);
if (index == -1) {
return;
}else if (index == 0) {
StartersListView.getItems().clear();
DessertsListView.getItems().clear();
DessertsListView.getItems().clear();
MainsListView.getItems();
}else if (index == 1) {
StartersListView.getItems().clear();
MainsListView.getItems();
DessertsListView.getItems();
}else if (index == 2) {
StartersListView.getItems();
MainsListView.getItems();
DessertsListView.getItems();
}
}
Thanks