I'm not sure why this is recursing.
jTable1.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent evt) {
int sum = 0;
int i=0;
for (i =0 ; i<2; i++){
sum = sum + Integer.parseInt(jTable1.getValueAt(0, i).toString());
}
jTable1.setValueAt(sum, 0, 2);
}
});
The exception is: (it keeps repeating)
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277)
at javax.swing.JTable.convertColumnIndexToModel(JTable.java:2553)
at javax.swing.JTable.getValueAt(JTable.java:2695)
at testprogram.guitest.TestTableModel$1.tableChanged(TestTableModel.java:63)
at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
at javax.swing.JTable.setValueAt(JTable.java:2719)
Any help appreciated.