Preselected path for ij.io.DirectoryChooser?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Preselected path for ij.io.DirectoryChooser?

Md Tamjidul Hoque
Dear All

            is it possible to call DirectoryChooser such a way that it
can start with a particular path / directory?

By the way, I think "setDefaultDirectory" can not be used or can we?

Any suggestion?

Thanks
Tamjid
       
Reply | Threaded
Open this post in threaded view
|

Re: Preselected path for ij.io.DirectoryChooser?

Michael Schmid
Hi Tamjid,

you can use setDefaultDirectory(String dir), that's what it is good  
for. You can even use it from a macro with a call
("ij.io.DirectoryChooser.setDefaultDirectory", dir); macro command.

Michael
________________________________________________________________

On 10 May 2010, at 06:20, Md Tamjidul Hoque wrote:

> Dear All
>
>            is it possible to call DirectoryChooser such a way that  
> it can start with a particular path / directory?
>
> By the way, I think "setDefaultDirectory" can not be used or can we?
>
> Any suggestion?
>
> Thanks
> Tamjid
>
Reply | Threaded
Open this post in threaded view
|

Re: Preselected path for ij.io.DirectoryChooser?

Md Tamjidul Hoque
Hi Michael

          thanks but I am not clear yet, perhaps I have to clarify my
problem:

               line #1: DirectoryChooser dc = new
DirectoryChooser("Preferred Directory:");
               line #2:            dc.setDefaultDirectory(t2.getText());


          The instance of DirectoryChooser is created first - so it will
already be loaded with the path/directory that was selected last, but I want
the "instance of DirectoryChooser" to come up with whatever is currently in
t2.getText() (BTW: t2 is a TextArea where a path is pasted).


In summary, the question could be, how can the line#2 be executed before
executing line # 1? Is it possible?

Obviously, instance of DirectoryChooser, when created and loaded, reads the
last selected directory from somewhere (I don't know where is that place and
how to access that?- so need to that)  - can we write our preferred
directory/path in that place first?


Any help/suggestion?

Thanks
Tamjid




On Mon, May 10, 2010 at 6:08 PM, Michael Schmid <[hidden email]>wrote:

> Hi Tamjid,
>
> you can use setDefaultDirectory(String dir), that's what it is good for.
> You can even use it from a macro with a
> call("ij.io.DirectoryChooser.setDefaultDirectory", dir); macro command.
>
> Michael
> ________________________________________________________________
>
>
> On 10 May 2010, at 06:20, Md Tamjidul Hoque wrote:
>
>  Dear All
>>
>>           is it possible to call DirectoryChooser such a way that it can
>> start with a particular path / directory?
>>
>> By the way, I think "setDefaultDirectory" can not be used or can we?
>>
>> Any suggestion?
>>
>> Thanks
>> Tamjid
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Preselected path for ij.io.DirectoryChooser?

Michael Schmid
Hi Tamjid,

DirectoryChooser.setDefaultDirectory is a static method, you can call  
it without any instance of DirectoryChooser but rather with the class  
name:

    DirectoryChooser.setDefaultDirectory(defaultdir);
    DirectoryChooser dc = new DirectoryChooser("Preferred Directory:");

The default directory is a static variable, it survives in memory  
without any instance of DirectoryChooser.

Michael
________________________________________________________________

On 10 May 2010, at 13:12, Tamjid wrote:

> Hi Michael
>
>           thanks but I am not clear yet, perhaps I have to clarify my
> problem:
>
>                line #1: DirectoryChooser dc = new
> DirectoryChooser("Preferred Directory:");
>                line #2:            dc.setDefaultDirectory(t2.getText
> ());
>
>
>           The instance of DirectoryChooser is created first - so it  
> will
> already be loaded with the path/directory that was selected last,  
> but I want
> the "instance of DirectoryChooser" to come up with whatever is  
> currently in
> t2.getText() (BTW: t2 is a TextArea where a path is pasted).
>
>
> In summary, the question could be, how can the line#2 be executed  
> before
> executing line # 1? Is it possible?
>
> Obviously, instance of DirectoryChooser, when created and loaded,  
> reads the
> last selected directory from somewhere (I don't know where is that  
> place and
> how to access that?- so need to that)  - can we write our preferred
> directory/path in that place first?
>
>
> Any help/suggestion?
>
> Thanks
> Tamjid
>
>
>
>
> On Mon, May 10, 2010 at 6:08 PM, Michael Schmid  
> <[hidden email]>wrote:
>
>> Hi Tamjid,
>>
>> you can use setDefaultDirectory(String dir), that's what it is  
>> good for.
>> You can even use it from a macro with a
>> call("ij.io.DirectoryChooser.setDefaultDirectory", dir); macro  
>> command.
>>
>> Michael
>> ________________________________________________________________
>>
>>
>> On 10 May 2010, at 06:20, Md Tamjidul Hoque wrote:
>>
>>  Dear All
>>>
>>>           is it possible to call DirectoryChooser such a way that  
>>> it can
>>> start with a particular path / directory?
>>>
>>> By the way, I think "setDefaultDirectory" can not be used or can we?
>>>
>>> Any suggestion?
>>>
>>> Thanks
>>> Tamjid
>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: Preselected path for ij.io.DirectoryChooser?

Md Tamjidul Hoque
Hi Michael

             oh, I missed that the method was static ... great!

Many thanks for the help.
Tamjid


Michael Schmid wrote:

> Hi Tamjid,
>
> DirectoryChooser.setDefaultDirectory is a static method, you can call
> it without any instance of DirectoryChooser but rather with the class
> name:
>
>    DirectoryChooser.setDefaultDirectory(defaultdir);
>    DirectoryChooser dc = new DirectoryChooser("Preferred Directory:");
>
> The default directory is a static variable, it survives in memory
> without any instance of DirectoryChooser.
>
> Michael
> ________________________________________________________________
>
> On 10 May 2010, at 13:12, Tamjid wrote:
>
>> Hi Michael
>>
>>           thanks but I am not clear yet, perhaps I have to clarify my
>> problem:
>>
>>                line #1: DirectoryChooser dc = new
>> DirectoryChooser("Preferred Directory:");
>>                line #2:            dc.setDefaultDirectory(t2.getText());
>>
>>
>>           The instance of DirectoryChooser is created first - so it will
>> already be loaded with the path/directory that was selected last, but
>> I want
>> the "instance of DirectoryChooser" to come up with whatever is
>> currently in
>> t2.getText() (BTW: t2 is a TextArea where a path is pasted).
>>
>>
>> In summary, the question could be, how can the line#2 be executed before
>> executing line # 1? Is it possible?
>>
>> Obviously, instance of DirectoryChooser, when created and loaded,
>> reads the
>> last selected directory from somewhere (I don't know where is that
>> place and
>> how to access that?- so need to that)  - can we write our preferred
>> directory/path in that place first?
>>
>>
>> Any help/suggestion?
>>
>> Thanks
>> Tamjid
>>
>>
>>
>>
>> On Mon, May 10, 2010 at 6:08 PM, Michael Schmid
>> <[hidden email]>wrote:
>>
>>> Hi Tamjid,
>>>
>>> you can use setDefaultDirectory(String dir), that's what it is good
>>> for.
>>> You can even use it from a macro with a
>>> call("ij.io.DirectoryChooser.setDefaultDirectory", dir); macro command.
>>>
>>> Michael
>>> ________________________________________________________________
>>>
>>>
>>> On 10 May 2010, at 06:20, Md Tamjidul Hoque wrote:
>>>
>>>  Dear All
>>>>
>>>>           is it possible to call DirectoryChooser such a way that
>>>> it can
>>>> start with a particular path / directory?
>>>>
>>>> By the way, I think "setDefaultDirectory" can not be used or can we?
>>>>
>>>> Any suggestion?
>>>>
>>>> Thanks
>>>> Tamjid
>>>>
>>>>
>