 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
RC Guest
|
Posted: Wed May 16, 2007 10:54 pm Post subject: Is this a bug in javax.swing.JFileChooser? |
|
|
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! |
|
| Back to top |
|
 |
SadRed Guest
|
Posted: Thu May 17, 2007 3:58 am Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
On May 17, 2:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Daniel Pitts Guest
|
Posted: Thu May 17, 2007 4:23 am Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
On May 16, 10:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
| Quote: | 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.FILES_AND_DIRECTORIES);
jFileChooser.showOpenDialog(null);
System.out.println("file = " +
jFileChooser.getSelectedFile());
}
}
</sscce> |
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Thu May 17, 2007 7:10 am Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
Daniel Pitts wrote:
...
| Quote: | 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.
|
(snip code)
Using that code, and Java 1.6 on XP, I could not reproduce
the behaviour described. In all combinations of single or
double clicks, the chooser correctly identified the directory
I was opening.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/1 |
|
| Back to top |
|
 |
SadRed Guest
|
Posted: Thu May 17, 2007 7:11 am Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
On May 17, 2:54 am, RC <raymond.c...@nospam.noaa.gov> wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
a24900@googlemail.com Guest
|
Posted: Thu May 17, 2007 1:50 pm Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
On May 16, 7:54 pm, RC <raymond.c...@nospam.noaa.gov> wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Steve W. Jackson Guest
|
Posted: Thu May 17, 2007 7:45 pm Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
In article <1179391846.721624.306580 (AT) q23g2000hsg (DOT) googlegroups.com>,
"a24900 (AT) googlemail (DOT) com" <a24900 (AT) googlemail (DOT) com> wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
Daniel Pitts Guest
|
Posted: Thu May 17, 2007 11:30 pm Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
On May 16, 8:01 pm, "Andrew Thompson" <u32984@uwe> wrote:
| Quote: | Daniel Pitts wrote:
..
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.
(snip code)
Using that code, and Java 1.6 on XP, I could not reproduce
the behaviour described. In all combinations of single or
double clicks, the chooser correctly identified the directory
I was opening.
On RedHat Linux, Java 5, I was able to reproduce the OP's "problem". |
So, apparently its been fixed in 1.6.
Daniel. |
|
| Back to top |
|
 |
..::WojT::.. Guest
|
Posted: Fri May 18, 2007 7:11 am Post subject: Re: Is this a bug in javax.swing.JFileChooser? |
|
|
| Quote: | 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.do?bug_id=5050516
...::WojT::.. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|