用JFileChooser选择路径保存文件
用JFileChooser选择路径保存文件
String ss = this.mailEditor.getText();//获得要保存的文本(可以包含回车)
JFileChooser jfc = new javax.swing.JFileChooser();
if(JFileChooser.APPROVE_OPTION == jfc.showSaveDialog(this)) {
File saveFile = jfc.getSelectedFile();
try {
if(!saveFile.exists()){
saveFile.createNewFile();
}
BufferedWriter bw = new BufferedWriter(
new FileWriter(saveFile));
bw.write(ss);
bw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
还可以 再保存的时候,如果保存的是目录里已经存在的文件,那么对话框不会关闭,...用JFileChooser选择路径... 1页 免费 喜欢此文档的还喜欢 印章保管交接单 2页...
(this); // 打"开保存文件"对话框 if (result == JFileChooser.APPROVE_...JFileChooser的例子 1页 免费 用JFileChooser选择路径... 1页 免费 JFileChooser...
弹出选择文件对话框 // 显示保存文件对话框 int state = fileLocalChoose.show...JFileChooser使用详解 4页 免费 JFileChooser 4页 免费 用JFileChooser选择路径.....
还可以再保存的时候,如果保存的是目录里已经存在的文件,那么对话框不会关闭,...*/ if(result == JFileChooser.APPROVE_OPTION) { /*获得你选择的文件绝对...
文件保存路径_电脑基础知识_IT/计算机_专业资料。可以修改文件保存路径直接...用JFileChooser选择路径... 1页 免费 文泰雕刻软件路径的做法... 9页 4下载...
使用同一个 JFileChooser 对象创建打开和保存对话框有以 下好处: (1)chooser 会...Files(); 4、选择目录 利用这个打开对话框,不仅可以选择文件,还可以选择目录。...
JFileChooser基本使用方法_计算机软件及应用_IT/计算机_专业资料。分类: Java 学习...还可以再保存的时候,如果 保存的是目录里已经存在的文件,那么对话框不会关闭,...
读取选择的文件时需使用 File[] files = c.getSelectedFiles(); 4、选择目录...JFileChooser文件选择器 2页 免费 c#打开、保存对话框的使... 8页 1下载券喜...
java swing文件选择JFileChooser的使用方法_IT/计算机_专业资料。/* * Utest.java...用JFileChooser选择路径... 1页 免费 JFileChooser文件选择器 2页 免费 swing...
JFileChooser 为用户选择文件提供了一种简单的机制,其方法有: boolean accept(...用JFileChooser选择路径... 1页 免费 JFileChooser的例子 1页 免费 java文件的...
10位置绘制筛子 } } } 15.4 各类选择部件的使用 15.4.1 AWT典型的选择...{ //保存文件 #45 try { #46 JFileChooser chooser = new JFileChooser( );...

我要评论