🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: repost: modifying JFileChooser

#7747
From: John McGrath TeamB
Date: Sun, 07 Jan 2001 08:22
32 lines
2299 bytes
On Fri, 05 Jan 2001 11:46:22 -0800, Kevin Dwan wrote:

> My question is how to modify the "File name: /_____/" label
> in my second (DIRECTORIES_ONLY) filechooser so that it says
> "Directory chosen".

There is no API for setting this, so there is no clean way to do it.  
And since the appearance of the JFileChooser is dependant on the look 
and feel, any solution might not work for any look and feel.  Remember 
that someone could be using one that you have never heard of before.

That said, you could try digging into the JFileChooser component tree, 
find the JLabel that has the text, and set it using setText().  If you 
use this approach, you will want to be careful how you code it, since 
you cannot be certain what you will find.  You should write the code to 
be very conservative about deciding to change something.  Your program 
will not crash if it fails to change the text, but might if you change 
something you should not.

You will also want to test your code with all of the look-and-feels 
that you can find.  Remember that the text displayed might be different 
in different look-and-feels.  (I think the Motif look-and-feel has a 
similar label, but the text is different.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.14c1e997ef0394db989e4f@forums.borland.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
References: <3A551881.D61DEB98@blueberry.com> <MPG.14bf55594c8634f2989e40@forums.borland.com> <3A56248E.70E29EA@blueberry.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,89fb584cc774168e
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2001-01-07 00:31:35 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: repost: modifying JFileChooser
Date: Sun, 7 Jan 2001 03:22:09 -0500
Organization: Another Netscape Collabra Server User
Lines: 32
Message-ID: <MPG.14c1e997ef0394db989e4f@forums.borland.com>
References: <3A551881.D61DEB98@blueberry.com> <MPG.14bf55594c8634f2989e40@forums.borland.com> <3A56248E.70E29EA@blueberry.com>
NNTP-Posting-Host: dslcv1-60.fast.net
X-Newsreader: MicroPlanet Gravity v2.30