wil*_*ood 13
就像MrWiggles所说,你可以从ListSelectionModel中获取它,你可以从表本身访问它.但是,JTable中还有一些方便的方法来获取所选行.如果您的表是可排序的等,您还需要通过convertRowIndexToModel方法:)
来自JTable JavaDoc:
int[] selection = table.getSelectedRows();
for (int i = 0; i < selection.length; i++) {
selection[i] = table.convertRowIndexToModel(selection[i]);
}
// selection is now in terms of the underlying TableModel
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9880 次 |
| 最近记录: |