Article View: borland.public.jbuilder.java.swing
Article #8251Re: JFileChooser size problem
From: Joi Ellis
Date: Fri, 06 Oct 2000 00:00
Date: Fri, 06 Oct 2000 00:00
60 lines
2806 bytes
2806 bytes
"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...!
[snip]
>
> 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.
>
> 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 found a way, I think!
Subclass the bugger and override getPreferredSize(). I just managed
to make a class of my own extend JFileChooser and override it to 800x600.
Now a call to showSaveDialog() shows me a BIG JDialog, not the dinky one.
Now to figure out how to make it do the right thing that it should have
done the first place...
public class PolicyChooser extends JFileChooser {
public PolicyChooser() {
super();
}
public PolicyChooser(File currentDirectory) {
super(currentDirectory);
}
public PolicyChooser(File currentDirectory, FileSystemView fsv) {
super(currentDirectory, fsv);
}
public PolicyChooser(FileSystemView fsv) {
super(fsv);
}
public PolicyChooser(String currentDirectoryPath) {
super(currentDirectoryPath);
}
public PolicyChooser(String currentDirectoryPath, FileSystemView fsv) {
super(currentDirectoryPath, fsv);
}
public Dimension getPreferredSize() {
return new Dimension(800,600);
}
}
--
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:
<39DE8A64.819A20AF@aravox.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39D7D59D.176E4FA5@aravox.com> <MPG.1445eb857969656e989bd0@forums.borland.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: Joi Ellis <joi@aravox.com> Subject: Re: JFileChooser size problem Date: 2000/10/06 Message-ID: <39DE8A64.819A20AF@aravox.com> X-Deja-AN: 678524997 Content-Transfer-Encoding: 7bit References: <39D7D59D.176E4FA5@aravox.com> <MPG.1445eb857969656e989bd0@forums.borland.com> To: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Aravox Technologies Mime-Version: 1.0 Reply-To: joi@aravox.com Newsgroups: borland.public.jbuilder.java.swing