String dir= f.getAbsolutePath();
dir= dir.substring(0, dir.length()-4)+"_1.txt";
File fn= new File(dir);
try{
FileWriter out= new FileWriter(fn);
for(int p=0;p<text.size();p++){
String s=text.get(p);
out.write(s);
}
}catch(IOException e3){
textArea.append("生成密钥出错:"+e3+'\n');
}
在控制台输出是没问题的,文件也已经生成了