JFileChooser中使用下面的方法路径上按一下按钮返回并不是所有的路径
问题描述:
(chooser.getCurrentDirectory()getAbsolutePath())\ WINDOWS \ TEMP 这里addLogText我得到仅记录c:\ windows。为什么临时文件夹被忽略/截断?JFileChooser中使用下面的方法路径上按一下按钮返回并不是所有的路径
答
您应该调用chooser.getSelectedFile()
而不是chooser.getCurrentDirectory()
,这将返回用户在filechooser中导航的当前目录。你的情况是C:\Windows
。