This is rather tough. Firstly I can't say I understand your question, especially the second paragraph. I can try giving you a few of tips though:
1) Read Swing tutorial for JTables (google for java swing jtable tutorial). 2) Implement a proper table model. 3) Implement a table model listener. (There are sections discussing these issues in the tutorial) 4) Post questions concerning Swing to Swing forum. 5) Remember that MVC has a lerning curve.
Best regards, Petr
Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
Assumption: You are presenting a bunch of data rows in the table, letting the user add/edit/delete them at will, and then saving all the changes at once (e.g. with a save button).
Given this pattern, you'll want to create a table model that tracks the changes the user makes for saving later. One method I've found useful is to maintain two extra collections along with the basic model: addedItems and removedItems.
When the user edits a row, either set up the row items to track this with a boolean or add a third collection to the model: editedItems.
Then, as the user makes changes, add the row items to the appropriate collection. Make sure the collection doesn't allow duplicate rows (you can't delete the same item twice).
When it's time to save the changes, either bundle them all up to send elsewhere (to an EJB or remote service or whatever) or apply the changes directly, collection-by-collection, row-by-row. Off the top of my head, in the past I'd delete items, then update items, then add items. This order allows the most likely combinations to occur naturally.
For example, starting with rows A, B and C, the user can delete row B, change row C to B, and add a new row C without problems. Of course, this can vary depending on your method of saving and the standard use cases.
As for the JTable (the view), it listens for various table-modification messages from your model. Therefore, your code (the controller) that responds to add/delete button presses and cell updates should operate on the model itself, and the table will repaint appropriately. [ November 04, 2004: Message edited by: David Harkness ]