JFileChooser的疑惑,当选择一个目录或文件后我怎么处理,比如我要把选中的文件导入一个LIST中,还有。。 5
我用只显示用户目录的MODEL,然后当我选择一个目录后,是不是这个目录下面的所有文件夹(子目录)里的文件我都选择了?我如何取得该目录下的每个文件夹名,再以每个文件夹为单元...
我用只显示用户目录的MODEL,然后当我选择一个目录后,是不是这个目录下面的所有文件夹(子目录)里的文件我都选择了?我如何取得该目录下的每个文件夹名,再以每个文件夹为单元导入一个LIST中,有高手知道吗,我感到很难,谢谢了
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lding;
/**
*
* @author ysr
*/
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFileChooser;
public class Chooser{
public void Chooser(){
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("choosertitle");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getName());
} else {
System.out.println("No Selection ");
}
}
}
这个是我定制的只显示目录的JFILECHOOSER,如何修改才能把选中的目录下的子文件夹,输出到一个LIST 展开
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lding;
/**
*
* @author ysr
*/
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFileChooser;
public class Chooser{
public void Chooser(){
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("choosertitle");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getName());
} else {
System.out.println("No Selection ");
}
}
}
这个是我定制的只显示目录的JFILECHOOSER,如何修改才能把选中的目录下的子文件夹,输出到一个LIST 展开
3个回答
展开全部
通行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Tiffany Co is well-known for its sterling silver jewelry, as sterling silver jewelry become more adorable and popular among people. For classic and quality bracelets, more and more people choose Tiffany Co because they believe that good tiffany bracelets need a proper home.
These lovely tiffany bracelets and this Elsa Peretti? Teardrop bracelet are throwing off their regal brilliance for amazing diamonds. Tiffany Co guarantee that all of them have absolutely excellent quality and unique design.
Want to see more buying advices for this Elsa Peretti? Teardrop bracelet. Please visit our community which have more useful tips or you can directly chat with us online
These lovely tiffany bracelets and this Elsa Peretti? Teardrop bracelet are throwing off their regal brilliance for amazing diamonds. Tiffany Co guarantee that all of them have absolutely excellent quality and unique design.
Want to see more buying advices for this Elsa Peretti? Teardrop bracelet. Please visit our community which have more useful tips or you can directly chat with us online
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询