title: Writing textFields/textArea to text file
body: <p>So in the applet I'm making I need the values from my two text fields and my text area written to a text file upon pressing the submit button. The Text is being read just fine, but it is not recording to the text document.</p>
  
  <p><code>nameField</code> and <code>topicField</code> are my two text fields, and <code>paragraphArea</code> is my text area. Topics.txt is the blank text file I have in my Java package. </p>
  
  <pre><code>   JButton submitButton = new JButton("SUBMIT");
      submitButton.setSize(100, 30);
      submitButton.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
  
  
              String name = nameField.getText();
              String topic = topicField.getText();
              String paragraph = paragraphArea.getText();
  
  
              String fileWrite = "Topics.txt";
  
              try {
                  FileWriter fileWriter =
                      new FileWriter(fileWrite);
  
                  BufferedWriter bufferedWriter =
                      new BufferedWriter(fileWriter);
  
                  bufferedWriter.newLine();
                  bufferedWriter.write(name);
                  bufferedWriter.newLine();
                  bufferedWriter.write(topic);
                  bufferedWriter.newLine();
                  bufferedWriter.write(paragraph);
                  bufferedWriter.newLine();
  
                  bufferedWriter.close();
              }
              catch(IOException ex) {
                  System.out.println(
                      "Error writing to file '"
                      + fileWrite + "'");
              }
  
          }
       });
  add(submitButton);
  }
  }
  </code></pre>
  
  <p>I really don't see what I'm doing wrong here. Any help would be greatly appreciated.</p>
  
  <p>EDIT:
  I figured out what the problem was, it was recording to the bin folder copy of the topics document, not the src. </p>