-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMMUTTableModel.java
More file actions
27 lines (17 loc) · 887 Bytes
/
Copy pathMMUTTableModel.java
File metadata and controls
27 lines (17 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import javax.swing.table.DefaultTableModel;
public class MMUTTableModel extends DefaultTableModel {
//https://stackoverflow.com/questions/12776021/how-to-make-jtable-cell-editable-noneditable-dynamically
private boolean[][] editable_cells; // 2d array to represent rows and columns
public MMUTTableModel(String[][] data, String[] columns) { // constructor
super(data, columns);
this.editable_cells = new boolean[data.length][columns.length];
}
@Override
public boolean isCellEditable(int row, int column) { // custom isCellEditable function
return this.editable_cells[row][column];
}
public void setCellEditable(int row, int col, boolean value) {
this.editable_cells[row][col] = value; // set cell true/false
//this.fireTableCellUpdated(row, col);//ha ezt kiszedem mukodik. nagyon szegyellem magam
}
}