2010/8/26 Johannes Schindelin <
[hidden email]>:
> 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
The other constructor takes a default directory and a default name,
but if both are not null, the file is directly opened without the
dialog being ever shown. At least that was the case a few ImageJ
versions ago, when invoked within the "run" method of a PlugIn that is
then run from the menus. I haven't tested recently.
Albert
--
http://albert.rierol.net