Access to native directory chooser

Steve Hannah steve at weblite.ca
Mon Oct 22 16:19:31 PDT 2012


Afaik quaqua is not actually a native dialog.  It just adopts a native
looking skin.  This means that it is incompatible with the app store
sandbox.
Steve



On Monday, October 22, 2012, Fabrizio Giudici wrote:

> On Mon, 22 Oct 2012 21:13:36 +0200, Sergey Bylokhov <
> Sergey.Bylokhov at oracle.com> wrote:
>
>  Hi, Robert.
>> This functionality was added to jdk and will be available in jdk 7u12 and
>> 8
>>
>> 7161437 : [macosx] awt.FileDialog doesn't respond appropriately for mac
>> when selecting folders
>> http://bugs.sun.com/**bugdatabase/view_bug.do?bug_**id=7161437<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7161437>
>>
>> 22.10.2012 22:46, Robert Krüger wrote:
>>
>>> Hi,
>>>
>>> we are currently using the following workaround to get a native
>>> directory chooser in our app:
>>>
>>>          try {
>>>              System.setProperty("apple.awt.**fileDialogForDirectories",
>>> "true");
>>>              fileDialog.setVisible(true);
>>>          } finally {
>>>              System.setProperty("apple.awt.**fileDialogForDirectories",
>>> "false");
>>>          }
>>>
>>> Is there anything other than JNI possible with JDK7?
>>>
>>> Thanks in advance,
>>>
>>> Robert
>>>
>>
> Probably there's something I'm not understanding, but I've been running a
> native Mac OS X filechooser since JDK 7u4 using Quaqua with this code:
>
>     private void runMacOSX (final @Nonnull Component parent)
>       {
>         final JFileChooser fileChooser = createFileChooser();
>
>         JSheet.showSaveSheet(**fileChooser, parent, new SheetListener()
>           {
>             @Override
>             public void optionSelected (final @Nonnull SheetEvent event)
>               {
>                 if (event.getOption() == APPROVE_OPTION)
>                   {
>                     onFileSelected(fileChooser.**
> getSelectedFile().toPath());
>                   }
>               }
>           });
>       }
>
>     @Nonnull
>     private JFileChooser createFileChooser()
>       {
>         final JFileChooser fileChooser = new JFileChooser();
>         fileChooser.setDialogType(**OPEN_DIALOG);
>         fileChooser.**setFileSelectionMode(type);
>         return fileChooser;
>       }
>
>
> I rather have problems with the Sheet rendering, which is not natively
> rendered due to a bug:
>
> http://java.net/jira/browse/**QUAQUA-160<http://java.net/jira/browse/QUAQUA-160>
>
>
>
> --
> Fabrizio Giudici - Java Architect @ Tidalwave s.a.s.
> "We make Java work. Everywhere."
> http://tidalwave.it/fabrizio/**blog <http://tidalwave.it/fabrizio/blog> -
> fabrizio.giudici at tidalwave.it
>


-- 
Steve Hannah
Web Lite Solutions Corp.


More information about the macosx-port-dev mailing list