🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTable Columns

#11357
From: Steve Horsley
Date: Tue, 15 Jun 1999 00:00
30 lines
1779 bytes
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.
//----------------------

Quach Hoa Thanh wrote:
> 
> Steve, the columns appeared when I put JTable inside JScrollPane. However It cut
> off the a bit the top of column title. I'm not sure why but I will mess around
> with it.
> 
> The reason I used DefaultTableModel instead of AbstractTableModel because I want
> to be able to manipulate rows such as adding, deleting and so on.. According to
> Java API docs, DefaultTableModel is a subclass of AbstractTableModel. It should
> work. If I find out a way to make it work, I will post the code here.
> 
> Thanh.
>
Technical Details
Message-ID: <37661363.BC903E98@cwcom.co.uk>
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>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,eb4b6527d333ff79
X-Google-Attributes: gid111d45,public
From: Steve Horsley <steve.horsley@cwcom.co.uk>
Subject: Re: JTable Columns
Date: 1999/06/15
Message-ID: <37661363.BC903E98@cwcom.co.uk>
X-Deja-AN: 489776916
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>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Cable & Wireless Communications
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing