12345678910111213141516171819202122232425 |
- package ui.view;
- import javax.swing.table.DefaultTableModel;
- public class DefaulTable extends DefaultTableModel {
- private boolean[][] editable_cells; // 2d array to represent rows and
- // columns
- DefaulTable(int rows, int cols) { // constructor
- super(rows, cols);
- this.editable_cells = new boolean[rows][cols];
- }
- @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);
- }
- }
|