Java JTable getting the data of the selected row

前端 未结 4 2001
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-01 18:43

Are there any methods that are used to get the data of the selected row? I just want to simply click a specific row with data on it and cli

4条回答
  •  感动是毒
    2021-01-01 19:48

    You can use the following code to get the value of the first column of the selected row of your table.

    int column = 0;
    int row = table.getSelectedRow();
    String value = table.getModel().getValueAt(row, column).toString();
    

提交回复
热议问题