bufferedreader - How can i edit line 2 in filereader and buffered reader - Java -
i have code when press button edit first line in txt file:
string editn = jtextfield13.gettext(); if (jtextfield18.gettext().equals("1")) { try { string verify, putdata; file file = new file("name.txt"); filewriter fw = new filewriter(file); bufferedwriter bw = new bufferedwriter(fw); bw.write(editn); filereader fr = new filereader(file); bufferedreader br = new bufferedreader(fr); while ((verify = br.readline()) != null) { if (verify != null) { putdata = verify.replaceall("here", "there"); bw.write(putdata); } } br.close(); bw.close(); filereader fr2 = new filereader(file); bufferedreader br2 = new bufferedreader(fr2); string line1 = br2.readline(); br2.close(); worker1.settext("1. " + line1); editworker.setvisible(false); workers.setvisible(true); workers.pack(); } catch(ioexception e) { e.printstacktrace(); } }
what need add edit second line? need edit edit second line in txt file.
wiki
Comments
Post a Comment