Posted by
Michael Schmid on
Mar 09, 2021; 11:44am
URL: http://imagej.273.s1.nabble.com/Choice-of-file-chooser-in-import-sequence-is-not-respected-tp5024507p5024508.html
Hi Stein,
which operating system are you using?
As far as I see, the DirectoryChooser can use the native Chooser of the
operating system only for Apple Macintosh. On Windows and Linux it seems
that there is no way to have a java.awt.FileDialog asking for a
directory, not a file.
I have compared ImageJ 1.49 and a recent version; the DirectoryChooser
code looks very similar in this respect. Under Linux I also did not
experience any changes in the recent years.
A way around would be a GenericDialog with addDirectoryField; this is
drag&drop-enabled, so one can avoid using the DirectoryChooser by
dragging a directory from the file manager (windows Explorer).
<What I would consider a nice feature, but it is currently not present,
is having the drag&drop onto a DirectoryField also work when dragging
files contaainded in a directory; very often one has the directory open
in the file manager (Explorer, Finder...). This means, automatically
stripping off the filename, i.e., using File.getParent().>
And a further idea: Would it be possible to make the JFileChooser in
ImageJ at a bit more user-friendly?
- By enabling drag&drop
- With UIManager.html.getCrossPlatformLookAndFeelClassName, to have it
look at least a bit more like the native dialog.
Unfortunately, having a JFileChooser with good Windows Look&Feel seems
to require com.sun.java.swing.plaf.windows.WindowsLookAndFeel, but this
is not present in OpenJDK (Oracle Java seems to have it at least up to
Java 8).
Michael
________________________________________________________________
On 09.03.21 09:51, Stein Rørvik wrote:
> We have under I/O options two choices:
>
> "Use JFileChooser to open/save"
> and
> "Use file chooser to import sequences"
>
> The former works as it should: If checked, the JFileChooser dialog is used when opening and saving files, and the native open/save file dialog box is used when unchecked.
>
> The problem is that the JFileChooser dialog is always used for the file/folder choice when importing sequences, both when "Use file chooser to import sequences" I/O option is checked and unchecked. So this choice is not respected.
>
> It appears that this problem was introduced when the new main dialog for file import was introduced in 1.53d. So I am talking about the dialog box that now appears after pressing the "browse" button. The main dialog still works as it should, also with drag-and-drop.
>
> Also, JFileChooser seems to always be active for the getDir("Choose a Directory") function; the setOption does not disable it in the following:
>
> setOption("JFileChooser", false);
> getDir("Choose a Directory");
>
> Perhaps these problems are related, that it is the same dialog as in the getDir("Choose a Directory") function that is called upon a click of the Browse button in the import dialog?
>
> JFileChooser does not work well on my system, so I prefer to have an option to disable it for all cases.
>
> Stein
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html