How to calculate total column value?
Hi, i am very new to java.
I have done a jtable however i need tocalculate row and column values.I have 3 cols. Col1 , Col2,Col3.I have to total up the Columns and rows.
I have looked around for sourcecode but to no avail.
Some are not even working.
Could someone pls help? ?
# 7
//this snippet get each row in column 0
for(int =0;i<tblModel.getRowCount();i++){
Double.valueOf(tblModel.getValueAt(i,0).toString()).intValue();
Double.valueOf(tblModel.getValueAt(i,1).toString()).intValue();
}
gurnah>
# 8
Change getColumnClass like this:
public Class getColumnClass(int col) {
if (col == TOTAL_COLUMN) return Double.class;
return String.class;
}