Re: Different directorychooser behavior
Posted by
Jon Harman-3 on
Dec 15, 2009; 12:04am
URL: http://imagej.273.s1.nabble.com/Different-directorychooser-behavior-tp3690099p3690100.html
Hi,
I just checked on a laptop and the behavior is normal there. So it is
some strange behavior that is confined to just my main computer.
Sorry to bother the list.
Jon
Jon Harman wrote:
> Hi,
>
> I use the directoryChooser in a plugin and have noticed different
> behavior in it lately. Maybe due to a Java update?
> The behavior (on Windows XP) is this:
> I use it twice, since I need to choose input and output directories for
> the plugin. The first time all is well, it opens in My Documents. I
> choose a subdirectory.
>
> Then the second time it opens two directories above the one that I
> chose, which requires more navigating to get back to where I was. This
> is confusing to Windows users who are not used to navigating above My
> Documents.
>
> The behavior used to be that it would open in the directory above the
> one I choose. It opens two directories above even when I set the
> default directory for the second choice. Here is my code:
>
> DirectoryChooser idc =
> new DirectoryChooser("Choose the input directory of RGB
> images");
> indir = idc.getDirectory();
> if(indir == null) return;
> idir = new File(indir);
> if (!idir.isDirectory() || !idir.exists()) {
> IJ.showMessage("Input directory error");
> return;
> }
> DirectoryChooser odc = new DirectoryChooser("Choose the output
> directory for enhanced images");
> odc.setDefaultDirectory(idir.getParent());
> outdir = odc.getDirectory();
> if(outdir == null) {
> return;
> }
>
> What am I doing wrong?
>
> Jon
>