🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11283

Re: JTable Columns

#11283
From: Quach Hoa Thanh
Date: Tue, 15 Jun 1999 00:00
27 lines
1654 bytes
Hi Steve, thank you again for your help.

Have you successfully inserted a row into JTable at run-time like the way we add a
record to the database. I tried your code and many other way I can think of, but so
far failed in every attempt. I know of one way is to change the model attaching to
JTable which contains different data.

Thanh

Steve Horsley wrote:

> I'm glad I was at least some help.
>
> I am adding rows using the AbstractTableModel quite happily.
> My model gets all its data from a Vector of InfoItem objects
> (my own object). I have one line in the table for each InfoItem.
> When I add a new InfoItem to the Vector, I do something like:
>     int x = myVector.size();
>     myVector.add(newItem);
>     myTableModel.fireTableRowsInserted(x, x);
> where x is the index number of the added object.
> I clear the table with:
>     myVector.clear();
>     myTableModel.fireTableDataChanged();
>
> Steve.
> //----------------------
Technical Details
Message-ID: <3766FF5D.81899083@ns.sympatico.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3763E235.80724A4@ns.sympatico.ca> <3764C6B6.8F6FF6EE@cwcom.co.uk> <37657039.C7B77F6F@ns.sympatico.ca> <3765839E.AEB2697@ns.sympatico.ca> <37661363.BC903E98@cwcom.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,eb4b6527d333ff79
X-Google-Attributes: gid111d45,public
From: Quach Hoa Thanh <thq.qua@ns.sympatico.ca>
Subject: Re: JTable Columns
Date: 1999/06/15
Message-ID: <3766FF5D.81899083@ns.sympatico.ca>
X-Deja-AN: 490073469
Content-Transfer-Encoding: 7bit
References: <3763E235.80724A4@ns.sympatico.ca> <3764C6B6.8F6FF6EE@cwcom.co.uk> <37657039.C7B77F6F@ns.sympatico.ca> <3765839E.AEB2697@ns.sympatico.ca> <37661363.BC903E98@cwcom.co.uk>
Content-Type: text/plain; charset=us-ascii
Organization: Self Employed
Mime-Version: 1.0
Reply-To: thq.qua@ns.sympatico.ca
Newsgroups: borland.public.jbuilder.java.swing