查看Sun的本教程页面:http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html.
基本实施涉及:
//Create a file chooser
final JFileChooser fc = new JFileChooser();
...
//In response to a button click:
int returnVal = fc.showOpenDialog(aComponent);
Run Code Online (Sandbox Code Playgroud)
返回值为您提供有关用户是单击"确定"还是"取消"等信息,然后您可以查询文件选择器对象以找出所选文件.