I'm fighting my way through learning Java, and my prof hasn't fully picked it up yet. When I use a JFileChooser object to allow users to open a file, how do I tell it to start at the same directory the program is stored in?
Thanks
I'm fighting my way through learning Java, and my prof hasn't fully picked it up yet. When I use a JFileChooser object to allow users to open a file, how do I tell it to start at the same directory the program is stored in?
Thanks
Please support the defense of Ukraine.
Direct or via Unclutter App
No Ads.
No Trackers.
No Social Media.
All Content Locally Hosted.
Built on Free Software.
We have complied with zero government requests for information.
~ Est. 1999 ~
A pillar of corporate stability since the second millenium.
© 1999-2999 Tom Owad
You use the setCurrentDirectory() method.
Example:
JFileChooser jFileChooser = new JFileChooser;
jFileChooser.setCurrentDirectory (new File ("."));
It looks like you just pass it a new file object, anyone know why this works?
because if you dont have an empty file object for it to put anything into it wont do nothing.