同楼上
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if (row == 你要不可编辑的行的标识) {
return false;
} else {
return true;
}
}
class MyTableModel extends AbstractTableModel {
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
return 你想返回的是否某行某列可否Edit
}
还有其他方法要继承重写,如
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return data[0].length;
}
public String getColumnName(int col) {
return " ";
}
public Object getValueAt(int row, int col) {
return data[col][row];
}