• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Delay in JFileChooser instantiation

I notice a very significant delay (sometimes 1 minute) in first-time instantiation of JFileChooser dialog in Java. The ddefault directory being opened has just 10 files. Can anybody help?
0
mkarthik_1975
Asked:
mkarthik_1975
1 Solution
 
CEHJCommented:
That's normal. You can speed the appearance of loading by pre-loading a FileSystemView and using that in your JFileChooser ctor
0
 
Thomas4019Commented:
As an alternative you could use FileDialog instead of JFileChooser. FileDialog uses the native FileDialog of your OS. So if you are using Windows, it shows the File open or save dialog that you are used to seeing. If you are using a Mac, it shows the Mac like dialog you are used to seeing.

FileDialog has far less advanced features, most notably, you cant select multiple files at once as far as i can tell. I suggest using FileDialog as it uses the OS Dialog which every already knows and has seen before. I think FileDialog should have the features you need though.

FileDialog is part of java.awt instead of javax.swing because it uses native code and is dependent upon the OS.
0
 
objectsCommented:
what os? (its *not* normal btw)

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
CEHJCommented:
Sorry - one minute is not normal. Delays are in my experience
0
 
objectsCommented:
make sure you are running the latest version of Java

0
 
sciuriwareCommented:
CEHJ, objects, I experienced such delays all of the time,
and I always run the latest JDK (1.6.0_13 at present).

;JOOP!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now