Advertisement
TheCodingKid

Simple File Chooser

Apr 28th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1.         JFrame.setDefaultLookAndFeelDecorated(true);
  2.         JDialog.setDefaultLookAndFeelDecorated(true);
  3.         JFileChooser fileChooser = new JFileChooser();
  4.         int returnValue = fileChooser.showOpenDialog(null);
  5.         if (returnValue == JFileChooser.APPROVE_OPTION) {
  6.             File selectedFile = fileChooser.getSelectedFile();
  7.             File testFile = fileChooser.getCurrentDirectory();
  8.             System.out.println(selectedFile.getName());
  9.             System.out.println(testFile);
  10.             System.out.println(testFile.getName()); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement