在路径按钮上使用以下方法单击:
public static void pathButtonAction() {
JFileChooser chooser = new JFileChooser();
if (pathToInbound == null) { //private static File pathToInbound;
chooser.setCurrentDirectory(new java.io.File("."));
} else {chooser.setCurrentDirectory(pathToInbound);
}
chooser.setDialogTitle("Choose folder with messages to send");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
pathToInbound = chooser.getCurrentDirectory();
addLogText(chooser.getCurrentDirectory().getAbsolutePath());
}
}
但是在这里我选择文件夹 c:\windows\temp 这里 addLogText(chooser.getCurrentDirectory().getAbsolutePath()) 我只记录 c:\windows。为什么临时文件夹被忽略/截断?