Part of path returned from Directories Only JFileChooser is sometimes duplicated?

Seems to work for me import javax.swing. JFileChooser; public class FChoose { public static void main(String args) { java.awt.EventQueue. InvokeLater(new Runnable() { public void run() { JFileChooser chooser = new JFileChooser(); chooser.

SetMultiSelectionEnabled(false); chooser. SetFileSelectionMode(JFileChooser. DIRECTORIES_ONLY); int returnVal = chooser.

ShowOpenDialog(null); if (returnVal == JFileChooser. APPROVE_OPTION) { java.io. File f = chooser.getSelectedFile(); System.err.

Println(f.getPath()); } }}); } } 6u13 on Vista. Is there something strange about your setup or what you are doing? If there's a specific bug in a Mac OS X implementation of Java, you may want to, say, check if the file exists and if not de-dupe the last to elements of the path.

Seems to work for me. Import javax.swing. JFileChooser; public class FChoose { public static void main(String args) { java.awt.EventQueue.

InvokeLater(new Runnable() { public void run() { JFileChooser chooser = new JFileChooser(); chooser. SetMultiSelectionEnabled(false); chooser. SetFileSelectionMode(JFileChooser.

DIRECTORIES_ONLY); int returnVal = chooser. ShowOpenDialog(null); if (returnVal == JFileChooser. APPROVE_OPTION) { java.io.

File f = chooser.getSelectedFile(); System.err. Println(f.getPath()); } }}); } } 6u13 on Vista. Is there something strange about your setup or what you are doing?

If there's a specific bug in a Mac OS X implementation of Java, you may want to, say, check if the file exists and if not de-dupe the last to elements of the path.

Same ver on XP, same positive result. – akf Jul 15 '09 at 22:30 Edited above, but I'm using Mac OS X and Java 1.6. – knt Jul 15 '09 at 22:33 And you get the same problem with my complete example? – Tom Hawtin - tackline Jul 15 '09 at 22:58 Ok actually I feel like an idiot now...used your example, works fine now.

I think I was actually using the wrong Dialog type in my own code, but copied it incorrectly when I wrote my question. Sorry for wasting your time and thanks for helping. – knt Jul 15 '09 at 23:18 Oh, everyone make mistakes!

I am interested in what you did wrong in the code you actually used. – Tom Hawtin - tackline Jul 15 '09 at 23:46.

The problem occurs when you use chooser. ShowDialog or chooser. ShowSaveDialog instead of chooser.showOpenDialog.

On XP chooser. ShowDialog returns the correct path under the example given by the OP, but on Mac OS 10.5.7 (and probably earlier versions as well) you'll get ~/Desktop/Desktop . (In my case I need to use showSaveDialog because I want users to have the option to create a new folder, so it looks like I'll have to de-dupe the path manually.It sure looks like this is a bug in the Apple Java implementation.

).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions