Im trying to format a float in a JTable thats been taken from an SQL database, heres what ive got:
{
float price = results.getFloat(5);
row = new Vector();
row.addElement(new String(results.getString(1)));
row.addElement(results.getString(2));
row.addElement(results.getInt(3));
row.addElement(results.getInt(4));
row.addElement("£"+ (price));
rows.addElement(row);
}
so i've given the getFloat(5) a variable name 'price' - how do i format the float 'price' to two decimal places, like 0.00? is it some thing like:
float price.%2f = results.getFloat(5);
I cant remember, thanks!
{
float price = results.getFloat(5);
row = new Vector();
row.addElement(new String(results.getString(1)));
row.addElement(results.getString(2));
row.addElement(results.getInt(3));
row.addElement(results.getInt(4));
row.addElement("£"+ (price));
rows.addElement(row);
}
so i've given the getFloat(5) a variable name 'price' - how do i format the float 'price' to two decimal places, like 0.00? is it some thing like:
float price.%2f = results.getFloat(5);
I cant remember, thanks!
