java file dialog

Solutions on MaxInterview for java file dialog by the best coders in the world

showing results for - "java file dialog"
Kristin
10 Jul 2020
1FileDialog fd = new FileDialog(yourJFrame, "Choose a file", FileDialog.LOAD);
2fd.setDirectory("C:\\");
3fd.setFile("*.xml");
4fd.setVisible(true);
5String filename = fd.getFile();
6if (filename == null)
7  System.out.println("You cancelled the choice");
8else
9  System.out.println("You chose " + filename);
Aliyah
02 Oct 2020
1FileDialog fd = new FileDialog(yourJFrame, "Choose a file", FileDialog.LOAD);
2fd.setDirectory("C:\\");
3fd.setFile("*.xml");
4fd.setVisible(true);
5String filename = fd.getFile();
6if (filename == null)
7    System.out.println("You cancelled the choice");
8else
9    System.out.println("You chose " + filename);