你是不是想作成象window里面的保存,选择文件的对话框吗,你可以用FileDialog类来实现
public FileDialog(Frame parent,
String title,
int mode)
Creates a file dialog window with the specified title for loading or saving a file.
If the value of mode is LOAD, then the file dialog is finding a file to read, and the files shown are those in the current directory. If the value of mode is SAVE, the file dialog is finding a place to write a file.
public FileDialog(Frame parent,
String title,
int mode)
Creates a file dialog window with the specified title for loading or saving a file.
If the value of mode is LOAD, then the file dialog is finding a file to read, and the files shown are those in the current directory. If the value of mode is SAVE, the file dialog is finding a place to write a file.
解决方案 »
- java基础问题
- 新手关于连接SQL Server的问题
- 请问怎样把一个word文件追加到另一个word文件,谢谢!
- 请问现在用java做界面程序的人多吗?公司多吗?
- 正则表达式分割字符串时候中文出现乱码,怎么解决
- 为什么按钮点了后,就没反应了?点右上角的X也没用
- 下面有代码有三个错误,帮我看一下。
- 在使用JFileChooser保存文件时的问题
- JAVA程序员薪资大调查(来者有分)-----找准你的身价
- 关于foreach遍历数组时,无法赋值的问题
- 据说新键一个对话框来读取字符串 会增加一个线程 退出程序需要用System.exit() 可是这样别的程序也推出了 啊
- 在同一个包里的两个类为什么不能互相调用?????(在线等)
里面用JTree显示文件系统的目录结构
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if(JFileChooser.APPROVE_OPTION == fc.showOpenDialog(null))
{
System.out.println(fc.getSelectedFile());
}