Index of the selected TableView cell in JavaFX


How can I get the column and row number when I click on a cell in the TableView? I came up with such a stupid way to find the column number:

((TablePosition) tableS.getSelectionModel().getSelectedCells().get(0)).getTableColumn().getText()

And then compare it with the names of the columns known to be known. This is very crooked, I understand. And which method is a good one?

In addition, then you will need to find out the contents of the first cell in the selected row.

That is, as a result, you only need to know the contents of the first cell in the selected row and the number the cells in this row that were clicked on.

Author: asurovenko, 2016-12-06

1 answers

getTableView().getItems().get(CustomerButtonCell.this.getIndex())
 2
Author: boden, 2016-12-06 21:56:32