Login  Register

Re: OpenDialog with multiple default extensions?

Posted by Michael Schmid on Jun 30, 2009; 6:05pm
URL: http://imagej.273.s1.nabble.com/about-macro-tp3691848p3691857.html

Hi Joachim,

as far as I can say, ImageJ OpenDialog does not support it.

java.awt.FileDialog has a setFilenameFilter method. There, you can  
check for, e.g., endsWith(".jpg") etc. I think that you can't modify  
the filter while the dialog box is open.
For a user-defined filter, you need the javax.swing.JFileChooser.


The downside of using java.awt.FileDialog or  
javax.swing.JFileChooser: no interfacing to the ImageJ macro langage  
unless you add code for it yourself. Also, the ImageJ default  
directory is not set.


Michael
________________________________________________________________

On 30 Jun 2009, at 19:49, Joachim Wesner wrote:

> Hi list,
>
> maybe it´s a silly question, but I don´t seem to find a solution,  
> also not
> in the list archive and docs:
>
> Is it possible to have an OpenDialog that display a limited number of
> default file extensions instead of one fixed default filename resp.  
> "*.*"?
>
> I would like to limit the filetypes to only certain selections, with
> probably "*.*" as the ultimate choice. This is very easy with Windows
> itself, even on a very low level.
> Can I do it with OpenDialog or is there a replacement?
>
> Thanks
>
> Joachim
>
> Mit freundlichen Grüßen / Best regards
>
> Joachim Wesner
> Projektleiter Optik Technologiesysteme