Swing 中设置jtable 行取消和选中常用如下:
//选中N-M行
table.setRowSelectionInterval(0, 0);//选中索引未0行
table..setRowSelectionInterval(0, 1);//选中索引0-1行
//追加选中
table.addRowSelectionInterval(1, 1);
table.addRowSelectionInterval(2, 2);
//取消选中
table.removeRowSelectionInterval(2, 2);
//选中所有
table.selectAll();
//取消所有
table.clearSelection();