Article View: borland.public.jbuilder.java.swing
Article #7578Re: tables
From: John McGrath TeamB
Date: Sat, 20 Jan 2001 08:24
Date: Sat, 20 Jan 2001 08:24
29 lines
2007 bytes
2007 bytes
On Fri, 19 Jan 2001 16:23:04 -0500, Steve Swett wrote:
> setValueAt appears to update a cell's value. How do you remove
> or add an entire row (after the table has already been shown on
> screen)? I have a table that is initially shown in "summary"
> but they can click a control elsewhere to show the table in
> "detail", which shows more rows. When they click back to
> "summary" mode it shows fewer rows once again.
The TableModel interface does not have methods for adding or removing
rows, but the DefaultTableModel implementation does.
You may want to consider using a custom table model for this. Such a
model could just hide the detail rows, while not actually deleting
them. It would simply fire TableModelEvents to tell the Table (or any
TableModelListener) that the rows had been deleted.
A more general approach is a "TableModel filter", which would implement
the TableModel interface, and provide a filtered view of another table
model.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.14d30dfc4ca601d8989edc@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!130.59.211.10.MISMATCH!merapi!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!not-for-mailReferences:
<3a675ee3_2@dnews> <MPG.14d1ddd6e0735d2989ecc@forums.borland.com> <3a684a71$1_1@dnews> <3a68af74_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,43228e9285db1269 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-20 00:30:34 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!130.59.211.10.MISMATCH!merapi!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!not-for-mail From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: tables Date: Sat, 20 Jan 2001 03:24:32 -0500 Organization: Another Netscape Collabra Server User Lines: 29 Message-ID: <MPG.14d30dfc4ca601d8989edc@forums.borland.com> References: <3a675ee3_2@dnews> <MPG.14d1ddd6e0735d2989ecc@forums.borland.com> <3a684a71$1_1@dnews> <3a68af74_1@dnews> NNTP-Posting-Host: dslcv1-60.fast.net X-Newsreader: MicroPlanet Gravity v2.30