Article View: borland.public.jbuilder.java.swing
Article #1488Re: How to permanantly set a custom CellRenderer to a jTable?
From: Paul Furbacher
Date: Thu, 11 Dec 2003 20:00
Date: Thu, 11 Dec 2003 20:00
40 lines
2436 bytes
2436 bytes
Zoran Pjevic wrote:
> But then when new data comes the TableModel calls either
> fireTableStructureChanged(), fireTableDataChanged() or
> fireTableRowsUpdated(0, size-1) ....
>
> After this I loose the CellRenderers and the Width of the Columns, ie.
> there set back to the default ones.
>
> How can I set a Custom Cell Renderer permanently or set the width of
> the columns permanently so that they
> will survive any of the previous mentioned events?
You'll notice that JTable's implementation recreates the
columns based on the value of "autoCreateColumnsFromModel".
The field is set to true in the constructor.
As I see it, you have two choices.
Try setting that field to false via its accessor.
Or, if that doesn't work to your satisfaction,
extend JTable and override the "tableChanged()"
method to do what you want.
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
Technical Details
Message-ID:
<3fd8ccd2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<060htvg1iaeb9qm879m00ghf3c0ln89j5m@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e2f4c37672465914 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-12-11 12:09:48 PST Date: Thu, 11 Dec 2003 15:00:16 -0500 From: Paul Furbacher <pfurbacher@mac.com> User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: How to permanantly set a custom CellRenderer to a jTable? References: <060htvg1iaeb9qm879m00ghf3c0ln89j5m@4ax.com> In-Reply-To: <060htvg1iaeb9qm879m00ghf3c0ln89j5m@4ax.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.39.103.120 Message-ID: <3fd8ccd2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071172818 68.39.103.120 (11 Dec 2003 12:00:18 -0700) Lines: 41 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail