posted 16 years ago
If you go through the API, you would find that JTextField has a method called setText.
If you delete a row, just calculate the total from the new contents again. Ideally you would take the total and subtract the value for the row, but once it is deleted you loose that entire row before the event is triggered.
Come to think of it, I think you can do this without TableModelListener if you create your own TableModel:
I may have missed a few methods that can change your table data, but you probably get the idea.
Also note how I only alter total after the call to the parent's method implementation (with super). If for some reason this method throws an exception your total will still be valid.
With this table model your total will always be up-to-date, and you can just retrieve it through a getter method.
[ October 17, 2008: Message edited by: Rob Prime ]