2014-03-04 30 views
1

我想知道在java中是否有一个GUI文件浏览器包,以节省我一些时间。文件加载/保存资源管理器Java

我正在谈论的东西就像在窗口中“浏览”文件以加载到媒体播放器时会看到的那样。

事情是这样的:

enter image description here

请我问,如果一个特定的软件包或方法存在以适应这一点。只说Jframe和swing并不是我正在寻找的东西。

+2

你的意思是像[JFileChooser](http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html)?在这种情况下,也看[这里](http://stackoverflow.com/questions/759376/alternative-to-jfilechooser) – fvu

回答

4

您正在寻找http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

JFileChooser chooser = new JFileChooser(); 
    int option = chooser.showOpenDialog(SimpleFileChooser.this); 
    if (option == JFileChooser.APPROVE_OPTION) { 
     statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null) ? chooser.getSelectedFile().getName():"nothing")); 
    } 
    else { 
     statusbar.setText("You canceled."); 
    } 
相关问题