As title says, I'm trying to make the file writer write onto a new line every time I click the save button, instead it just overwrites whatever was previously saved in the file.
Code:
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try{
PrintWriter fileWriter = new PrintWriter("passwords.txt", StandardCharsets.UTF_8);
fileWriter.print(webApp.getText());
fileWriter.print(": ");
fileWriter.print(pass.getText());
fileWriter.close();
} catch (IOException b) {
b.printStackTrace();
}
pass.setText(null);
webApp.setText(null);
}
});
}