简体   繁体   中英

how to limit the pre-loading of files in Java (JFileChooser)

I have a Java program to search and load Excel files from the PC to use it in a SAS proyect. Usually works well but when I install it in a server with thousands of folders it takes too long and I would like to do it in seconds, not in 15 minutes.

I think is because JFileChooser try to load all directories and disk (the server has many disks). So I'd like to limit the search to the disk in witch I work. My programme is such that:

private String createProyect() {
   JFileChooser fileopen = new JFileChooser();
   FileFilter filter = new FileNameExtensionFilter(NEW_PROYECT, EXTENSION_XLS, EXTENSION_XLSX);
   fileopen.addChoosableFileFilter(filter);
   ...}

Maybe I need to use a configuration file but I don't know how.

Perhaps you are looking for FileSystemView ?

If you use it, you will be able to modify the scope of your JFileChooser, like this example shows: Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM