java - JFileChooser doesn't return full file name on OSX 10.7 -
The problem is that the The issue occurs at OSX 10.7.4 with the issue SA 10.6.0_33-B3-424. Does anyone know a job for this, or can at least confirm this incident? Edit: In addition, I've seen some very interesting things, it works correctly for some files The same files that have view extensions in the searcher, but for those who do not show this extension, it fails. I've checked that files actually contain Edit: After turning on 'All File Name Extensions', explorer Jeffery Chaseer unveils one It started returning the filename with the extension, it looks like a design error in the underlying implementation of JFileChooser, and it does not really help in solving the problem because in my case it is a consumer product, which is the average user . I update some parts of your code, and I get this output Is: C: \ users Arrow \ Documents \ My Games \ Skyrim \ RendererInfo.txt C: \ Users \ Arno \ Documents \ My Games \ Skyrim \ RendererInfo.txt RendererInfo.txt C: \ Users \ Arno \ Documents \ My Games \ Skyrim \ RendererInfo. Txt Here is the update code: file is returned by object
JFileChooser is incomplete file name. To be more accurate, the file extension returns a filename without the part. I have tried to retrieve the path by using
getPath ,
getAbsolutePath and
getCanonicalPath , but it is still the same path without the extension portion gives. The same program and code work on Windows, Linux, and OSX 10.6 is OK
Jeffery Charge myImageChooser = new JFileChooser (); MyImageChooser.setFileSelectionMode (JFileChooser.FILES_ONLY); Int val = myImageChooser.showDialog (Newsframe.This, "Choose Image"); JFileChooser myImageChooser = new JFileChooser (); MyImageChooser.setFileSelectionMode (JFileChooser.FILES_ONLY); Int val = myImageChooser.showDialog (Newsframe.This, "Choose Image"); If (val == JFileChooser.APPROVE_OPTION) {file f = myImageChooser.getSelectedFile (); System.err.println (myImageChooser.getSelectedFile () getAbsolutePath ().); Try {System.err.println (myImageChooser.getSelectedFile). GetCanonicalPath ()); } Hold (IOException pre) {Logger.getLogger (NewJFrame.class.getName ()). Log (Level.SEVERE, null, ex); } System.err.println (myImageChooser.getSelectedFile). GetName ()); System.err.println (myImageChooser.getSelectedFile () getPath ().); // loadImage (f); //Util.event(LoadImage ", f.getName ());}
Jeffery Charge myImageChooser = New Jfile Chupper (); MyImageChooser.setFileSelectionMode (JFileChooser.FILES_ONLY); Int val = myImageChooser.showDialog (blank, "Choose Image"); If (val == JFileChooser.APPROVE_OPTION) {file f = myImageChooser.getSelectedFile (); System.err.println (myImageChooser.getSelectedFile) .getAbsolutePath ()); Try {System.err.println (myImageChooser.getSelectedFile) .getCanonicalPath ()); } Hold (IOException pre) {} System.err.println (myImageChooser.getSelectedFile). GetName ()); System.err.println (myImageChooser.getSelectedFile () getPath ().); // Load Image (F); // Util.event ("LoadImage", f.getName ()); }}
Comments
Post a Comment