<AWT Dev>  Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
marco.dinacci at gmail.com
Thu Aug 9 01:54:21 PDT 2012
> 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" ?
@synthesize window = _window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
NSButton *button = [[[NSButton alloc] initWithFrame:
[[_window contentView] addSubview: button];
[button setTitle: @"Button"];
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg runModalForDirectory:nil file:nil];
More information about the awt-dev