public void mouseDown(MouseEvent e) { try{ //指定目标文件 RandomAccessFile F = new RandomAccessFile("F:\\test.txt","rw");
//检索文件长度 long filelength = F.length(); // String content = text.getText(); //指针指向最后一位 F.seek(filelength); F.writeBytes(text.getText()+"\n"+text_1.getText() + "\n"+ btnCheckButton.getVisible()); F.close(); JOptionPane.showMessageDialog(null, "writein complet"); }catch (IOException S){ S.printStackTrace(); }
Java RandomAccessFile 文件写入,布布扣,bubuko.com
原文:http://www.cnblogs.com/yangzijiang/p/3782032.html