[Advanced-java] fileDialog question
David Rosenstrauch
david.rosenstrauch at aleri.com
Wed Aug 27 19:43:17 2003
Well, according to the API, there's a setControlButtonsAreShown() method in
the JFileChooser. See:
http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/JFileChooser.html#setControlButtonsAreShown(boolean)
You, of course, could have looked that up as easily as I just did ...
If that doesn't work for you, then maybe 1) you can just lift what you need
out of the JFileChooser source code, or 2) you can subclass it and override
some behavior.
But a better answer to your question is: why are you trying to do this? 90%
of the time that people use JFileChooser is to use it to open a standard file
open/save dialog. It's industry standard for apps to use the
platform-standard file dialog whenever they want the user to pick a file. I
don't see why you'd want to deviate from that standard in a GUI unless you
had a really good reason. And I can't think of one off the top of my head.
I image that part of the reaon why Sun didn't include much functionality for
what you're asking is specifically BECAUSE it's industry standard to not do
that. But - hey - it's your app ...
HTH,
DR
On Wednesday 27 August 2003 02:21 pm, Mark Yang wrote:
> Thank you david, I am sorry but I made a mistake in my previous
> question, I AM using JFileChooser, which has an OK button and a CANCEL
> button by default, I know i might be able to rename them, but what I
> really want is to get ride of these 2 buttons.
> My application is like this: I have a frame that has 2 windows, the
> left one displays the file structure on the other machine ( I have
> another application running on that machine and read the file names and
> send it over through socket), I still didn't figure out how to display
> these files and do select yet.( anyone has an idea?)
> The right side one, like you said, I am using the FileChooser, but i
> don't want any buttons on these 2 windows except one button called
> "transfer", if i click it, it will transfer the file on the other
> machine to my local directory.
>
> Anyone has comment on how to make this GUI work?
> thanks in advance!
>
>
> Mark