public class MyTable extends TableModel{
public static final int C = 12;
public static final int R = 25;
public String[][] data;
public MyTable(String[] h, String[][] data) {
this.data = data;
}
public boolean isCellEditable(int rowIndex, int columnsIndex) {
if (columnsIndex == 0)
return true;
else
return false;
}
public void removeTableModelListerner(TableModelListener s) {
}
public int getRowCount() {
return data.length;
}
public int getColumnCount() {
return heading.length;
}
public Class<?> getColumnClass(int columnIndex) {
for (int row = 0; row < getRowCount(); row++) {
Object o = getValueAt(row, columnIndex);
if (o != null) {
return o.getClass();
}
}
return Object.class;
}
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex][columnIndex];
}
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
data[rowIndex][columnIndex] = (String) aValue;
try {
fireTableCellUpdated(rowIndex, columnIndex);
} catch (TException ex) {
Logger.getLogger(TabellaDati.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void addTableModelListener(TableModelListener l) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void removeTableModelListener(TableModelListener l) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void fireTableCellUpdated(int rowIndex, int columnIndex){
String[][] newMatrix = Matrix.getMatrix();
for(int i=0,j=0; i<N_RIG; i++,j++)
System.arraycopy(newMatrix[j], 0, data[i], 0, data[i].length);
}
}