Reputation: 79
Hello: I am using Jtable with JScrollpane and Jpanel. The table is set to DefaultTableModel and Columns are added with addColumn("Column Name); method. Rows are added with addRow(Vector); method. Now I want to sum up all the column values and display the summed result to a particular JTextField. I searched a lot for the answer but unable to got the reliable answer.
Upvotes: 1
Views: 700
Reputation: 639
DefaultTableModel have a method getValueAt(int row, int column); You can iterate over the columns and compute the total using value from getValueAt method.
Upvotes: 2