title: Append to text file using PrintStream
body: <p>I cant append text to a text file, it only overwrites the previous text. My code:</p>
  
  <pre><code>//using JFileChooser to select where to save file
  PrintStream outputStream = MyFrame.ShowSaveDialog();
      if(outputStream!=null){
          outputStream.append(input);
          outputStream.close();
      } 
  </code></pre>
  
  <p>Edited:
  The ShowSaveDialog returns a PrintStream. Here is the code for that method:</p>
  
  <pre><code>public static PrintStream ShowSaveDialog(){
      JFileChooser chooser = new JFileChooser();
      FileNameExtensionFilter filter = new FileNameExtensionFilter(
              "Tekst filer", "txt");
      chooser.setFileFilter(filter);
  
      int returnVal = chooser.showSaveDialog(null);
      try{
          if(returnVal == JFileChooser.APPROVE_OPTION){
  
              return new PrintStream(chooser.getSelectedFile());              
          }
          else{
              return null;
          } 
      }
      catch(FileNotFoundException e){
          JOptionPane.showMessageDialog(null, "Ugyldig Fil!",
                     "error", JOptionPane.ERROR_MESSAGE);
      }
      return null;
  
  }
  </code></pre>