Francisco Farías
Francisco Farías

Reputation: 227

What is the JavaFX TableView's method equivalent to JTable.getSelectedRow()

I need it to access the information inside a tableview in my program so I can display a window (stage) with more information of the elements in the selected rows of the table. Thank you very much.

Upvotes: 2

Views: 336

Answers (1)

Sergey Grinev
Sergey Grinev

Reputation: 34528

To get selected item from table use next code:

table.getSelectionModel().getSelectedItem()

selection model also has other convenience methods to provide info about index, multiple selection, etc.

Upvotes: 2

Related Questions