I created a function to write into a data file, and it works well enough. But the problem is, I need the function to write into the NEXT line rather than the current line.
This is my function:
/*a method to add data...need it to somehow make sure that it
ALWAYS writes to the NEXT line, rather than appending to the current line*/
public static void addData(String str){
try {
BufferedWriter out = new BufferedWriter(new FileWriter("nlc2008.dat", true));
out.write(str);
out.close();
} catch (IOException e) {
}
}
Also, I have an action listener for a button called addInfo, but for some reason whenever I try to check the source ( by writing source = event.getsource() and then doing if (source = addInfo) ), it says that addInfo is invalid.
I also have several more questions that dispersed all in the comments of my code.
Please someone take the time to answer at least some of the questions.
I have attached my .java files and the .dat file as .txt files. (because apparently im not supposed to post .java or .dat files)
model.txt -> copy and paste text into notepad and save as model.java
table.txt -> copy and paste text into notepad and save as table.java and put in same folder as model.java
nlc2008.txt -> copy and paste text into notepad and save as nlc2008.dat and put in the same folder (or whereever it needs to be for the file to be found by the program)
Expert advice greatly valued!!!
Thanks in advance.
Attached File(s)
-
table.txt (4.56K)
Number of downloads: 141 -
model.txt (4.88K)
Number of downloads: 99 -
nlc2008.txt (390bytes)
Number of downloads: 128

New Topic/Question
Reply




MultiQuote




|