Java Swing JTable has a getSelectedRow()
method, but does not have a setSelectedRow()
method.
I need to highlight/select a row in a JTable. How should I proceed?
haha, the eternal question - and neither Howard nor Cris found the direct cover methods :-)
table.setRowSelectionInterval(first, last)
table.addRowSelectionInterval(first, last)
ListSelectionModel selectionModel =
table.getSelectionModel();
selectionModel.setSelectionInterval(start, end);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With