Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created October 21, 2012 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cellane/3926638 to your computer and use it in GitHub Desktop.
Save Cellane/3926638 to your computer and use it in GitHub Desktop.
private void readFile () {
FileReader fileReader;
FileDialog fileDialog = new FileDialog (new Frame (), "Open File", FileDialog.LOAD);
String fileName, line;
fileDialog.setVisible (true);
if (fileDialog.getFile () != null) {
fileName = fileDialog.getDirectory () + fileDialog.getFile ();
input.setText ("");
try {
fileReader = new FileReader (fileName);
input.read (fileReader, fileDialog.getFile ());
} catch (IOException ioe) {
ioe.printStackTrace ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment