public void jButton1_actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(parent); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); jTextField1.setText(file.toString()); } }