Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!

cracked.io | Best Forum Around | Free Premium Accounts




 11582

JavaFX Help

by Jmatts54 - 27 February, 2020 - 12:50 AM
This post is by a banned member (Jmatts54) - Unhide
Jmatts54  
Registered
110
Posts
19
Threads
6 Years of service
#1
(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:
 
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
This post is by a banned member (hasi912) - Unhide

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)