我不知道table.setRowSelectionInterval(0,0)行不行,不过看注解setRowSelectionInterval(int index0, int index1) “Selects the rows from index0 to index1, inclusive”应该是可以的。
还有一个方法,经过实践检验是可以的。
changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
“Updates the selection models of the table, depending on the state of the two flags: toggle and extend.”
这本来是用作单元格选中的方法。不过可以借用,只要将table的选择模式设为行选择就可以了。