我已经弄清楚了如何逐行读取并将文本文档的内容逐行显示到 jtextarea 中,并且我已经弄清楚了如何从字符串数组逐行写出到文本文档。我只是很难从 textarea 中获取每一行,只要我可以将每一行放入一个数组中,我就可以开始了。下面是我将用来将每一行写入文件的代码......
public class FileWrite {
public static void FileClear(String FileName) throws IOException{
FileWriter fstream = new FileWriter(FileName,true);
BufferedWriter out = new BufferedWriter(fstream);
out.write("");
}
public static void FileWriters(String FileName, String Content) throws IOException
{
FileWriter fstream = new FileWriter(FileName,true);
BufferedWriter out = new BufferedWriter(fstream);
out.append(Content);
out.newLine();
}
}
谢谢
C