JFileChooser jfc=new JFileChooser();
//弹出框名称
jfc.setDialogTitle("文件存储");
//按照默认方式显示
jfc.showSaveDialog(null);
jfc.setVisible(true);
//文件路径
String file=jfc.getSelectedFile().getAbsolutePath();
//准备写入到指定文件
FileWriter fw=null;
BufferedWriter bw=null;
try{
fw=new FileWriter(file);
bw=new BufferedWriter(fw);
//存储
bw.write(this.jta.getText());
}
catch(Exception e1 ){
e1.printStackTrace();
}
finally
{
try {
fw.close();
bw.close();
} catch (IOException e1) {
// TODO 自动生成的 catch 块
e1.printStackTrace();
}
}![图片说明](https://img-ask.csdn.net/upload/201606/07/1465283537_755238.jpg)