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);