title: Writing JTextArea content into file
body: <p>I have one JTextArea and a Submit button in Java Swing.
  Need to write the content of textarea into a file with line breaks.
  I got the output like, it is written as one string in the file.</p>
  
  <pre><code>try {
      BufferedWriter fileOut = new BufferedWriter(new FileWriter("filename.txt")); 
      String myString1 =jTextArea1.getText();
      String myString2 = myString1.replace("\r", "\n");
  
      System.out.println(myString2);
  
      fileOut.write(myString2);
      fileOut.close();
  } catch (IOException ioe) {
      ioe.printStackTrace();
  }
  </code></pre>
  
  <p>Please get me some suggestions</p>