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

 

对话框获取目录、文件路径 代码
   
     
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;
}

 

 

 

你可能感兴趣的:(对话框)