Article View: borland.public.jbuilder.java.swing
Article #553Re: Format a field in a table
From: Anton
Date: Mon, 27 Jun 2005 11:18
Date: Mon, 27 Jun 2005 11:18
41 lines
2140 bytes
2140 bytes
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)" <paul@comp.net> escribi๏ฟฝ en el mensaje
news:42bf1cb6@newsgroups.borland.com...
> 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.
Technical Details
Message-ID:
<42bfe06d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42b69446@newsgroups.borland.com> <42bf1cb6@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,bf3b431b3c33630f X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII From: "Anton" <anton@anton.com> Newsgroups: borland.public.jbuilder.java.swing References: <42b69446@newsgroups.borland.com> <42bf1cb6@newsgroups.borland.com> Subject: Re: Format a field in a table Date: Mon, 27 Jun 2005 12:18:40 +0100 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 217.124.46.248 Message-ID: <42bfe06d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1119871085 217.124.46.248 (27 Jun 2005 04:18:05 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail