This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a JTable which I create by 1st creating an ArrayList with information out of a database and 2nd using that ArrayList to create an Object. Now, I want to use figures in my table to do a few mathamatical operations.
In a little more detail, it is a list of transaction, each transaction a delta balance field (money in or money out). I now want to create an additional column with the balance of the account at the time of that transaction. (Basic checkbook register design). How in the world do I go about doing that?
Create your own TableModel implementation. The simple way is to extend DefaultTableModel and override a few methods:
This basically adds one extra column to the columns specified in the constructor. These methods handle this special column, or use the default behaviour for all other columns.
Thank you so very much. I finally got it to work thanks to your help. Now I just have one last question. Is there a way to get the last column to show up as the 2nd column? I will continue to try to find the answer alone, but a push in the right direction is always helpful. Thanks again.