请问如何显示目录对话框?java中好像没有吧。

lake2005 2005-10-26 04:11:37
请问如何显示目录对话框?java中好像没有吧。高手指点下呀!!
...全文
144 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
AMDCPU 2005-11-09
  • 打赏
  • 举报
回复
保存文件是文件操作的事啦,
lake2005 2005-11-07
  • 打赏
  • 举报
回复
我现在要得到的是,当我点击保存后,将该文件或目录保存起来。
bright_wish 2005-10-30
  • 打赏
  • 举报
回复
public SimpleSwingTextEditor() {
JFrame frame= new JFrame();
frame.setSize(480, 284);
frame.setTitle("编辑器");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButtion jButton = new javax.swing.JButton();
frame..getContentPane().add(jButton);
jButton.setText("Load File");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
loadFile();
}
});
}

private void loadFile() {
int state = jFileChooser.showOpenDialog(frame);
if (state == JFileChooser.APPROVE_OPTION) {
File f = jFileChooser.getSelectedFile();
try {
BufferedReader br = new BufferedReader(new FileReader(f));
jTextArea.read(br, null);
br.close();
frame.setTitle(title);
hasChanged = false;
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
pioneer_csdn 2005-10-28
  • 打赏
  • 举报
回复
java.swing包里的JFileChooser```

楼主多看看JAVA的文档
bovy 2005-10-27
  • 打赏
  • 举报
回复
private final class SelectDstAction extends MouseAdapter
{
public void mouseReleased(MouseEvent e)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setMultiSelectionEnabled(true);
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(MainApp.getFrame()))
{
txtDstFiles.setText(chooser.getSelectedFile().getAbsolutePath());
dstFiles.add(chooser.getSelectedFile());
}
}
}
cqlgc 2005-10-27
  • 打赏
  • 举报
回复
JFileChooser Class!

62,629

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧