title: Converting a file from FileChooser to a string in Java
body: <p>This is my first time using JFileChooser in Java and I'm currently attempting to convert the selected folder from a file type to a string such that I can write it to a JTextField on the GUI automatically so the user can confirm what they have selected.</p>
  
  <p>The section of code I'm working on is as follows:</p>
  
  <pre><code>JButton btnSel1 = new JButton("Select...");
      btnSel1.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
              int returnVal = fc.showOpenDialog(null);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                  File file = fc.getSelectedFile();
                  fol1 = fc.getFileAsString(file);
                  rawIn1.setText(fol1);
              }   
          }
      });
      welFrame.getContentPane().add(btnSel1, "6, 6, center, default");
  </code></pre>
  
  <p>Where I want the variable 'fol1' (folder 1) to be written into the JTextField 'rawIn1'. </p>
  
  <p>The method getFileAsString returns the the error "is undefined for the type JFileChooser"</p>
  
  <p>Thanks in advance to anyone who looks over this for me.</p>
  
  <p>Jared.</p>