Article View: borland.public.jbuilder.java.swing
Article #1324Re: Dynamically Change Column Header
From: Paul Furbacher
Date: Wed, 07 Jan 2004 16:09
Date: Wed, 07 Jan 2004 16:09
40 lines
2441 bytes
2441 bytes
Matthew Sweet wrote:
> I would like to be able to change a column name in the table header by
> selecting the name from a group of radio buttons. Is there some sort of
> simple interface that I can get to like setColumnHeaderat(whatever) from an
> event to change the name of a column header. I've played around with the
> examples I've obtained from my last post "Combo Box in Table header" but ran
> into look and feel issues (among some others) and just basically want to be
> able to push a button and Bam! my particular column header text is changed
> to something else.
Add ActionListeners to the radio buttons which
all point to a single method:
void actionPerformed(ActionEvent e) {
// based on the value of "e", get the
// desiredHeaderName
table.getColumnModel()
.getColumn(index)
.setHeaderValue(desiredHeaderName);
}
--
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:
<3ffc2f41$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!news.he.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ffb30ed$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e6d889a033380a3b X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2004-01-07 08:31:12 PST Date: Wed, 07 Jan 2004 11:09:35 -0500 From: Paul Furbacher <pfurbacher@mac.com> User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: Dynamically Change Column Header References: <3ffb30ed$1@newsgroups.borland.com> In-Reply-To: <3ffb30ed$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.39.103.120 Message-ID: <3ffc2f41$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1073491777 68.39.103.120 (7 Jan 2004 08:09:37 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!news.he.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail