get value from jtable and format double number

hi friends

i have problem with getting value from jtable and format it.

i want to get value from database and add it to my jtable value with formatted.

i wrote my code like that.

NumberFormat fmt=new DecimalFormat("0.##");

myobject=jtable.getmodel().getvalueat(row,column);

mydouble=Double.parsedouble(obj.tostring());

mydouble=mydouble+Double.parsedouble(rs.getstring("litre");

mystring=fmt.format(mydouble);

jtable.setvalueat(mystring,row,column);

it gives an error.

please help me!!!

[560 byte] By [frknmla] at [2007-11-27 11:31:40]
# 1

here's a sample:

DecimalFormat format = new DecimalFormat("#.##");

String str = "";

float total;

str = table.getModel().getValueAt(row, column).toString();

total += Float.parseFloat(str);

table.getModel().setValueAt(format.format(total), row, column);

but it is better if you post your SSCCE

http://mindprod.com/jgloss/sscce.html

Yannixa at 2007-7-29 16:41:05 > top of Java-index,Desktop,Core GUI APIs...