Reputation: 616
I managed to get the selected last value of the ListView with getSelectedItem(), but i cannot find out how to run through every value inside so that with SelectionMode.MULTIPLE i can get all the selected values.
listView.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent event) {
label.setText(listView.getSelectionModel().getSelectedItem());
}
});
Upvotes: 0
Views: 2183
Reputation: 36722
You can use :
listView.getSelectionModel().getSelectedItems();
It will return a ObservableList<T>
with all the selected items.
Upvotes: 2