对话框获取目录、文件路径

代码
public File getFile(){
final JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
// JFileChooser.FILES_ONLY
// JFileChooser.DIRECTORIES_ONLY
int returnVal = fc.showOpenDialog(this);
File file_choosed
= fc.getSelectedFile();
return file_choosed;
}
原文地址:https://www.cnblogs.com/frostbelt/p/1766355.html