hey everyone,
well i got a little problem im trying to write input from the JTextField into the file (file4.txt) but the problem is it keeps overwriting the text file each time i make input and any data ther was is changed in to new data.all i need is that it would add the new information below the old information.
any suggestions?
public void actionPerformed(ActionEvent e) {
String nameText = enterName.getText();
try
{
BufferedWriter bufewr;
bufewr = new BufferedWriter(new FileWriter("file4.txt"));
for (int i=0; i<1; i++)
{ bufewr.write(nameText);
bufewr.newLine();
System.out.println("string= " + nameText);
}
bufewr.flush();
bufewr.close();
}
catch(IOException e)
{ System.err.println("Exception: " + e.getMessage());
System.exit(1);
}
}
any suggestion would be greatly appreciated
thank you