🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JFileChooser size problem

#8256
From: James Cook
Date: Sun, 08 Oct 2000 00:00
88 lines
3699 bytes
When I created my JFileChooser, I setAccessory(mypanel).
Make sure your accessory panel has an appropriate preferred size.

After that I called:

chooser.invalidate();
chooser.validate();

jim
--
                        _              _
  ___  _ __   ___ _ __ | |_ ___   ___ | | __  _____
 / _ \| '_ \ / _ \ '_ \| __/ _ \ / _ \| | \ \/ / __|
| (_) | |_) |  __/ | | | || (_) | (_) | |  >  <\__ \
 \___/| .__/ \___|_| |_|\__\___/ \___/|_| /_/\_\___/
      |_|
   http://www.javabuilders.com/opentools/index.html
     Striving to add useful functions to JBuilder.

"Joi Ellis" <joi@aravox.com> wrote in message
news:39DCAF46.691AA246@aravox.com...
> "John McGrath [TeamB]" wrote:
> >
> > On Sun, 01 Oct 2000 19:23:57 -0500, Joi Ellis wrote:
> >
> > > It looks like JFileChooser is forcing its initial size to
> > > 500x300 and to hell with what I'm telling it...!
> >
> > It looks like you called that one right.  The following code is from
> > MetalFileChooserUI.java:
> >
> >     // Preferred and Minimum sizes for the dialog box
> >     private static int PREF_WIDTH = 500;
> >     private static int PREF_HEIGHT = 300;
> >     private static Dimension PREF_SIZE = new Dimension(
> >         PREF_WIDTH, PREF_HEIGHT);
> >        :
> >        :
> >     public Dimension getPreferredSize(JComponent c) {
> >         return PREF_SIZE;
> >     }
> >
> > Other look-and-feels have different hard-coded sizes, but the size is
> > hard coded in all of the standard look-and-feels.
>
> Like, Buh??  Hello, Sun!
>
> >
> > This is pretty cheesy if you ask me.  I cannot think of any reason why
> > the FileChooserUI implementations could not have sized the dialog based
> > on a minimum size for the file list and the preferred size of the
> > accessory.
>
> Will you be having Cheddar or Baby Swiss with that, Sir?
>
> > The only way that I can think to deal with it, save writing your own UI
> > delegate classes, is to set the preferred size for the JFileChooser.
But
> > the size you will need will be different for different look-and-feels,
so
> > the best you can do is to select a different size depending on the name
> > of the look-and-feel.
>
> I'm pretty sure I tried that but I spun the tread off so many wheels I
couldn't
> swear to anything, now.  I could try getting the preferred size and
increasing it
> by some amount.
>
> >
> > If I think of something better, I will let you know.
>
> I wonder what Jim Cook did for his multifile tool?  I don't think it
> suffers from this issue, but then he's using a custom JFileChooser
> with the multifile select issue fixed, too.
>
> Hey, Jim!  Could you share your expertise?
>
>
>
> --
> Joi Ellis                    Software Engineer
> Aravox Technologies          joi@aravox.com, gyles19@visi.com
>
> No matter what we think of Linux versus FreeBSD, etc., the one thing I
> really like about Linux is that it has Microsoft worried.  Anything
> that kicks a monopoly in the pants has got to be good for something.
>            - Chris Johnson
Technical Details
Message-ID: <8rq3u0$d5p3@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39D7D59D.176E4FA5@aravox.com> <MPG.1445eb857969656e989bd0@forums.borland.com> <39DCAF46.691AA246@aravox.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,2f241fe4201eef13
X-Google-Attributes: gid111d45,public
From: "James Cook" <jimcook@visualxs.com>
Subject: Re: JFileChooser size problem
Date: 2000/10/08
Message-ID: <8rq3u0$d5p3@bornews.borland.com>
X-Deja-AN: 678974373
References: <39D7D59D.176E4FA5@aravox.com> <MPG.1445eb857969656e989bd0@forums.borland.com> <39DCAF46.691AA246@aravox.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing