title: Browse For a Text File to Read From
body: <p>I'm trying to make a program in Java where the user is able to click a browse button and then be able to browse through directories for a text file.</p>
  
  <p>Once they select that text file, I plan to read from it in order to load some of its data into variables, but the part im working on right now is just getting the browse button to work; then I will move onto the reading from the text file.</p>
  
  <p>Right now I have a <code>JButton</code> with an empty action listener, and a non-editable text field in which i want to load the files path into.</p>
  
  <p>I see others talking about the <code>JFileChooser</code> class, but the examples they are always using the <code>JFileChooser</code> to for saving files or actually opening them, I do not want the file to be opened for the user, I just want the path so I know where to read from. Let me know if you need more information.</p>
  
  <p>Thank you for all the help, I was able to find the information I needed with in the JavaDocs, I now have my absolute path loaded into the JTextField and from here I will move onto the reading of the file, Thanks all.</p>
  
  <pre><code>browseButton.addActionListener( new ActionListener() {
      public void actionPerformed(ActionEvent e) {
          // yet to come...
      }
  });
  </code></pre>