Board index » jbuilder » Format a field in a table

Format a field in a table


2005-06-20 06:02:42 PM
jbuilder1
Hi
How can I show a integer number in a specified column in a table, it shows
me with decimals.
I don't know how to format it. I use a model and a JTable.
Thanks
 
 

Re:Format a field in a table

Pep wrote:
Quote
Hi
How can I show a integer number in a specified column in a table, it shows
me with decimals.
I don't know how to format it. I use a model and a JTable.

Thanks
What Model are you using? Formatting the fields can be done through the
Column and Row specifiers in the Model you are using.
 

Re:Format a field in a table

Hi.
This is the code I use
DefaultTableModel model = new DefaultTableModel();
JTable jt = new JTable(model);
int j = 0;
while (rs.next()) {
Vector row = new Vector(columns);
for (int i = 1; i <= columns; i++) {
row.addElement(rs.getObject(i));
}
model.insertRow(j++, row);
}
rs.close();
stm.close();
As you can see, from the rs I get the data and these values are passed to
the table via model, so I can put the value in one column like I want. for
example as integer or float.
Thanks
"Paul Nichols (TeamB)" < XXXX@XXXXX.COM >escribi?en el mensaje
Quote
Pep wrote:

>Hi
>How can I show a integer number in a specified column in a table, it
>shows
>me with decimals.
>I don't know how to format it. I use a model and a JTable.
>
>Thanks


What Model are you using? Formatting the fields can be done through the
Column and Row specifiers in the Model you are using.
 

{smallsort}