• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser open file problem  RSS feed

 
linda lichelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
am learning java and i encountered a curious problem. am sorry if this has been handled before, but i didn't find a similar topic.
before starting JFileChooser to OPEN a file, it checks the local diskette drive a:\ and this is quite strange, then i inserted the directory correctly!
now. after choosing 'ignore' in the dialog my JFileChooser appears with the correct initial directory. after the program started once, opening the JFileChooser next times won't cause it to check the a:\ drive. i tried this on several computers, all working with jdk 1.3.1 on nt4 6th service pack.
i would be really thankful for help on this as my program isn't conform to a fine usability just because of that.
thank you
linda
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... I'm using JDK 1.3.1 on Windows 2000 and my JFileChooser defaults to the user home directory... So it's probably a system dependent thing. The easiest way to overcome this is to call setCurrentDirectory(File) where File represents some good default starting directory the first time the user opens the app...
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Linda,
Nathan is no doubt right, the problem lies in the native code on NT4. Time to move up to Windows 2000.
Hope this helps,
Michael Morris
 
inam paki
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Linda;
If U don't wana change ur Plateform u can use the Second method defined by Nathan.Or U can create ur JFileChooser with a constructor pointing to the current user directory.
 
linda lichelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all, thank you, it worked modifying the JFileChooser constructor. thank you again and have a nice time.
linda
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!