当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How do I allow the user to edit a single row in JTable?

问题描述:

The JTable should allow only a particular, selected row to be edited. The rest of the table should be in the non-editable mode. Upon clicking a an "Edit" button, it should ideally just take into consideration the row number and make it editable.

网友答案:

Override isCellEditable() in your table's TableModel and return true for the desired row:

private static final int DESIRED_ROW = …;

@Override
public boolean isCellEditable(int row, int column) {
    return row == DESIRED_ROW;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: