Login  Register

Re: How to change the "default folder"?

Posted by dscho on Aug 26, 2010; 4:36pm
URL: http://imagej.273.s1.nabble.com/How-to-change-the-default-folder-tp3687164p3687166.html

Hi,

On Thu, 26 Aug 2010, Albert Cardona wrote:

> 2010/8/26 Norbert Vischer <[hidden email]>:
> > When opening or saving a file via Java, I want to present a file
> > dialog that displays a desired directory that the user most probably
> > will choose as destination. However, I don't know how to influence the
> > OS - it usually makes its own decisions and presents a completely
> > different "default folder". (On the Mac, I couldn't solve this problem
> > since many years) - Any ideas?
>
>
> With ij.io.OpenDialog, use the
> OpenDialog.setDefaultDirectory("/path/to/some/dir");
>
> See http://rsb.info.nih.gov/ij/developer/api/ij/io/OpenDialog.html

You can also use the other constructor which even takes a default name
(which can be null as far as I can tell):

http://pacific/javadoc/ij/io/OpenDialog.html#OpenDialog(java.lang.String,%20java.lang.String,%20java.lang.String)

Ciao,
Johannes