rmundkowsky
asked on
JTable setValueAt not being executed
Hello,
I am extending "AbstractTableModel" using Java 1.3. I can double click on a cell and enter data into the JTable, but all of the entered data disappears when I double click a different cell ("change editing focus"). "setValueAt" is not executed, but "isCellEditable" is executed. A snippet of the "AbstractTableModel" is listed below:
public boolean isCellEditable(int row, int col){ return true; }
public void setValueAt(Object aValue,int rowIndex, int colIndex) {
data[rowIndex][colIndex] = (aValue==null?aValue:aValu e.toString ());;
fireTableCellUpdated(rowIn dex, colIndex);
}
I am extending "AbstractTableModel" using Java 1.3. I can double click on a cell and enter data into the JTable, but all of the entered data disappears when I double click a different cell ("change editing focus"). "setValueAt" is not executed, but "isCellEditable" is executed. A snippet of the "AbstractTableModel" is listed below:
public boolean isCellEditable(int row, int col){ return true; }
public void setValueAt(Object aValue,int rowIndex, int colIndex) {
data[rowIndex][colIndex] = (aValue==null?aValue:aValu
fireTableCellUpdated(rowIn
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>I am extending "AbstractTableModel" using Java 1.3
You may well find that extending DefaultTableModel is much easier as the basic functionality is already implemented for you.
You may well find that extending DefaultTableModel is much easier as the basic functionality is already implemented for you.
ASKER
Found my problem, I was overloading "editingStopped" when I extended JTable. Thank you all for you inputs.
Can you post your getValueAt() method.