hello
i'm trying to code 'Save Button' which saves all the information in a file
this is what I did:

private void SaveButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           

    java.io.File file=new java.io.File("File.txt");


        try {
            java.io.PrintWriter output = new java.io.PrintWriter(file);
            output.print(this.DateObject.getText());
            output.print(this.NoteObject.getText());


            output.close();
        } catch (FileNotFoundException ex) {
            System.out.println("");
        }


}                         

the problem is if I try to save new information in the same file it will delete the previous file and creat a new one meaning all previous information will be deleted
how can I fix that?
what I want to do is simply everytime I click save button it should save the new information in same file ...
and I'm building my GUI using GUI builder so i'm not coding to add buttons and all that stuff
thank you

Open your file in append mode:

PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));