There seems to be a bug in the TableViewSelectionModel, though the javadocs don't help much on what is to be expected. However in the following code, if I select and then un-select (ctl-click) a row in a I get the following values for the following code:
private TableView<Person> personTable;
....
personTable.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showPersonDetails(newValue));
.....
int selectedIndex = personTable.getSelectionModel().getSelectedIndex(); // returns 5 in selectedIndex
boolean rowSelected = personTable.getSelectionModel().isSelected(selectedIndex); // returns false to rowSelected
I notice that even if you ctl-click to unselect a row, there is still an outline on the row. Hope this is enough info/contextually clear. Seems straight-forward enough.
private TableView<Person> personTable;
....
personTable.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showPersonDetails(newValue));
.....
int selectedIndex = personTable.getSelectionModel().getSelectedIndex(); // returns 5 in selectedIndex
boolean rowSelected = personTable.getSelectionModel().isSelected(selectedIndex); // returns false to rowSelected
I notice that even if you ctl-click to unselect a row, there is still an outline on the row. Hope this is enough info/contextually clear. Seems straight-forward enough.