<AWT Dev> [8] Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders

niagarasoft20-macosxportdev at yahoo.com niagarasoft20-macosxportdev at yahoo.com
Thu Aug 9 06:29:21 PDT 2012

Marco, I don't know, but I'm just describing the same behaviors that was in the previous Apple Java implementations (i.e. choosing directories only + using [Choose] ) when setting the apple.awt.fileDialogForDirectoriessystem property flag. 

I should know because, about 2 years ago, I filed the same bug for Apple Java to be consistent with it's previous versions. It looks like they just hard coded the [Choose] button text because when I run it with different locales set, it always says 

Thanks again for all your hard work!


> From: Marco Dinacci <marco.dinacci at gmail.com>
>To: "niagarasoft20-macosxportdev at yahoo.com" <niagarasoft20-macosxportdev at yahoo.com> 
>Cc: Sergey Bylokhov <Sergey.Bylokhov at oracle.com>; "macosx-port-dev at openjdk.java.net" <macosx-port-dev at openjdk.java.net>; "awt-dev at openjdk.java.net" <awt-dev at openjdk.java.net>; Anthony Petrov <anthony.petrov at oracle.com> 
>Sent: Thursday, August 9, 2012 4:54 AM
>Subject: Re: [8] Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
>> Just so that you know, the behavior of this dialog is different than the default OS X directory chooser behavior in that directory choosers to not allow users to also select files.
>True but unfortunately if you allow only for directory selection (by
>passing NO to setCanChooseFiles: when fCanChooseDirectories is YES)
>then there's no way to allow for both file and directory selection.
>The best would be to have control over both setCanChooseFiles and
>setCanChooseDirectories from Java but I guess that's part of the RFE.
>>Also the default select button should read [Choose] and not [Open]. So in the CFileDialog.m file the private method :
>The CFileDialog doesn't explicitly set the prompt string so I guess
>the behaviour depends on the OS version or on the localization.
>Setting it explicitly would override the default string and
>potentially confuse users. This test program on OSX Lion always
>displays "Open" no matter which combination of YES an NO I pass to
>setCanChooseFiles and setCanChooseDirectories. On which OS version do
>you see "Choose" ?
>#import "AppDelegate.h"
>@implementation AppDelegate
>@synthesize window = _window;
>- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
>    NSButton *button = [[[NSButton alloc] initWithFrame:
>                     NSMakeRect(10,10,120,40)] autorelease];
>    [[_window contentView] addSubview: button];
>    [button setTitle: @"Button"];
>    [button setTarget:self];
>    [button setAction:@selector(openDialog)];
>- (void)openDialog
>    NSOpenPanel* openDlg = [NSOpenPanel openPanel];
>    [openDlg setCanChooseFiles:YES];
>    [openDlg setCanChooseDirectories:YES];
>    [openDlg runModalForDirectory:nil file:nil];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20120809/7760db93/attachment.html 

More information about the awt-dev mailing list