Results 1 to 2 of 2
  1. #1
    jadaleus is offline Member
    Join Date
    Oct 2008
    Rep Power

    Default saving to a new line a text

    If I want to save a new line of text in text file how do I do so without replacing the existing text:

    here is part of my code:

    if(event.getSource() == signupButton) {

    try {outFile1 = new PrintWriter ( new BufferedWriter( new FileWriter("register.txt")));
    outFile1.print(usernameField.getText()+", ");
    outFile1.print(password.getText()+", ");

    JOptionPane.showMessageDialog(null,"Data have been Saved");

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    Read the API doc for the file writing classes to see how they work and if there is an option for adding/appending text to the end of the file.

    Or see your previous post where this was answered:

Similar Threads

  1. Saving to a Text File
    By jadaleus in forum Advanced Java
    Replies: 2
    Last Post: 10-17-2008, 06:50 PM
  2. Styled Text with highlighted Odd Line
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 02:31 PM
  3. [SOLVED] what is text limit line?
    By Nicholas Jordan in forum NetBeans
    Replies: 12
    Last Post: 07-16-2008, 05:05 AM
  4. [SOLVED] Text Area new line problem
    By Jay-1.1 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 04:18 AM
  5. Reading in data from file line by line
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 10-02-2007, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts