title: Swing Java GUI reading a text file with scanner
body: <p>I am trying to build a GUI app, which would read a text file on the press of a button
  and then save contents of this file to a string. My current code, I basically tried to adapt my console code for the gui, but it doesnt seem to work. Here is my button code:</p>
  
  <pre><code> private void convertButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
  
  
      Scanner user_input = new Scanner(tempTextField.getText());
  
      String seq1 = user_input.next();
  
      Scanner scanner = new Scanner(new File(seq1));
      scanner.nextLine();
      String content = scanner.useDelimiter("\\Z").next();
  
  
      int N = content.length();
  
      textarea.append("Length of the input string is: "+N);
  }
  </code></pre>
  
  <p>textarea = JtextArea
  tempTextField = JTextField</p>
  
  <p>Thank you.
      edit: I'm using netbeans IDE</p>