previous | start | next

Code to Use a JFileChooser

JFileChooser chooser new JFileChooser();
FileReader in = null;
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
{
    File selectedFile = chooser.getSelectedFile();
    in = new FileReader(selectedFile);
}

  note: JFileChooser is in java.io



previous | start | next