๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
3 messages
3 total messages Started by Pep Mon, 20 Jun 2005 10:02
Format a field in a table
#548
Author: Pep
Date: Mon, 20 Jun 2005 10:02
6 lines
977 bytes
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
#552
Author: Paul Nichols (TeamB)
Date: Sun, 26 Jun 2005 07:57
12 lines
1240 bytes
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.
Re: Format a field in a table
#553
Author: Anton
Date: Mon, 27 Jun 2005 11:18
41 lines
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. 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads