jtable - java.math.BigDecimal cannot be cast to java.lang.String? -
i trying add row values of datatype(money) in zeros after decimal automatically formed in jtable these 55.0000 28.0000 60.0000 20.0000 50.0000
on runtime log showing error
java.math.bigdecimal cannot cast java.lang.string
here code rows addition jtable
double total = 0; for(int = 0; i<table.getrowcount(); i++){ double amount = double.parsedouble((string) table.getvalueat(1, 6) ); total+=amount; } totalsum.settext(string.valueof(total));
*
is there way add float type values??
- *
try this:
bigdecimal total = bigdecimal.zero; (int = 0; < table.getrowcount(); ++i) { final bigdecimal amount = (bigdecimal)table.getvalueat(i, 6); total = total.add(amount); } totalsum.settext(total.tostring());
Comments
Post a Comment