Link to home
Start Free TrialLog in
Avatar of rmundkowsky
rmundkowskyFlag for Afghanistan

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:aValue.toString());;
       fireTableCellUpdated(rowIndex, colIndex);
}
Avatar of Mick Barry
Mick Barry
Flag of Australia image

How do you know setValueAt() is not getting called.

Can you post your getValueAt() method.
ASKER CERTIFIED SOLUTION
Avatar of allelopath
allelopath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>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.
Avatar of rmundkowsky

ASKER

Found my problem,  I was overloading "editingStopped" when I extended JTable.  Thank you all for you inputs.