Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Is this a bug in javax.swing.JFileChooser?

Reply
Thread Tools

Is this a bug in javax.swing.JFileChooser?

 
 
RC
Guest
Posts: n/a
 
      05-16-2007
When I open a JFileChooser.
If I SINGLE click a directory and click the Open button.
Then I got return $paths/selected_directory.

That is good!

However if I DOUBLE click a directory and click the Open button.
Then I got return $paths/selected_directory/selected_directory

Why I got selected_directory twice from return?
Is this a bug or I missed somethings?

Do you have a solution for that?
Thank Q very much in advance!
 
Reply With Quote
 
 
 
 
SadRed
Guest
Posts: n/a
 
      05-16-2007
On May 17, 2:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
> When I open a JFileChooser.
> If I SINGLE click a directory and click the Open button.
> Then I got return $paths/selected_directory.
>
> That is good!
>
> However if I DOUBLE click a directory and click the Open button.
> Then I got return $paths/selected_directory/selected_directory
>
> Why I got selected_directory twice from return?
> Is this a bug or I missed somethings?
>
> Do you have a solution for that?
> Thank Q very much in advance!


> Then I got return $paths/selected_directory/selected_directory

It was:
$paths/selected_directory/another_selected_directory(or file)
and a normal behavior of the JFileChooser GUI.

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      05-16-2007
On May 16, 10:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
> When I open a JFileChooser.
> If I SINGLE click a directory and click the Open button.
> Then I got return $paths/selected_directory.
>
> That is good!
>
> However if I DOUBLE click a directory and click the Open button.
> Then I got return $paths/selected_directory/selected_directory
>
> Why I got selected_directory twice from return?
> Is this a bug or I missed somethings?
>
> Do you have a solution for that?
> Thank Q very much in advance!


If you notice, when you first click the directory, the name appears in
the text field.
When you double click, you enter that directory, but the name stays in
the text field.

The name staying in the text field is definitely what causes your
described behavior.
<sscce>
import javax.swing.*;
public class FileChoo {
public static void main(String[] args) {
final JFileChooser jFileChooser = new JFileChooser();

jFileChooser.setFileSelectionMode(JFileChooser.FIL ES_AND_DIRECTORIES);
jFileChooser.showOpenDialog(null);
System.out.println("file = " +
jFileChooser.getSelectedFile());
}
}
</sscce>

 
Reply With Quote
 
SadRed
Guest
Posts: n/a
 
      05-17-2007
On May 17, 2:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
> When I open a JFileChooser.
> If I SINGLE click a directory and click the Open button.
> Then I got return $paths/selected_directory.
>
> That is good!
>
> However if I DOUBLE click a directory and click the Open button.
> Then I got return $paths/selected_directory/selected_directory
>
> Why I got selected_directory twice from return?
> Is this a bug or I missed somethings?
>
> Do you have a solution for that?
> Thank Q very much in advance!


If it is
$paths/selected_directory/another_selected_directory_or_file
that is a normal behavior of the JFileChooser GUI.



 
Reply With Quote
 
a24900@googlemail.com
Guest
Posts: n/a
 
      05-17-2007
On May 16, 7:54 pm, RC <raymond.c...@nospam.noaa.gov> wrote:
> Why I got selected_directory twice from return?
> Is this a bug or I missed somethings?


JFileChooser is broken in many twisted ways. Sun says this is how it
has to be and closed all related bug reports.

 
Reply With Quote
 
Steve W. Jackson
Guest
Posts: n/a
 
      05-17-2007
In article < .com>,
"" <> wrote:

> On May 16, 7:54 pm, RC <raymond.c...@nospam.noaa.gov> wrote:
> > Why I got selected_directory twice from return?
> > Is this a bug or I missed somethings?

>
> JFileChooser is broken in many twisted ways. Sun says this is how it
> has to be and closed all related bug reports.


Nice opinion. Now back it up with some examples of what's broken. I've
been using it successfully for some years now and don't find any major
issues with it.
--
Steve W. Jackson
Montgomery, Alabama
 
Reply With Quote
 
..::WojT::..
Guest
Posts: n/a
 
      05-18-2007
> Nice opinion. Now back it up with some examples of what's broken. I've
> been using it successfully for some years now and don't find any major
> issues with it.


Are You really sure ?
What about this annoying bug:
http://bugs.sun.com/bugdatabase/view...bug_id=5050516

...::WojT::..


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57