J#-保存一个文件

JFileChooser fc = new JFileChooser("F:");

int resultSave = fc.showSaveDialog(this);
if(resultSave == 0)
{

try
{
File f = fc.getSelectedFile();
FileWriter out = new FileWriter(f);
out.write(txt.getText());
out.close();
}
catch(Exception ee)
{
ee.printStackTrace();
}
}

 

posted on 2014-07-06 22:36  ylbtech  阅读(95)  评论(0)    收藏  举报