With one ListView, it is possible to select multiple items from it, with the line:
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
Then retrieve the items selected with:
selectedItems = listView.getSelectionModel().getSelectedItems();
However, I have two ListViews (listView
and listView2
) in one window. Is there any way to select items across both these lists (by the user holding down Ctrl
and selecting items)?
Edit to clarify:
For example, I want to be able to select items 1, 4, 5, and 6, then press Delete
. I can hold down Ctrl
and select 4, 5, and 6 from list1
, then select 1 from list2
. However, if I then change my mind, and actually want to just select 8, so I release Ctrl
and select 8, then everything in list2
should be deselected.