JTable : how to get selected cells?
问题 I have a JTable and its TableModel, it works well but what I want to do now is to get the selected cells of it. I thought of doing something like : int rows = this.getTable().getRowCount(); int columns = this.getTable().getColumnCount(); for(int i = 0 ; i < rows ; i++) { for(int j = 0 ; j < columns ; j++) { if(table.getCell(i,j).isSelected() //... } } But of course something like this doesn't exist. What should I do instead? 回答1: In JTable, you have the JTable.getSelectedRow() and JTable