How can I make a JFileChooser on the Mac that lets users create directories?
Asked Answered
L

2

4

I have an installer program that lets the user choose a directory in which to install. The JFileChooser implementation on MacOS uses a native dialog (or at least it looks native). That's great.

The only problem is there's no way to create a directory from this dialog ... you can only choose a pre-existing one, which is clunky. Is there a way to get this functionality?

I use the JFileChooser in "select directories only" mode. Thus it isn't the same dialog as the usual MacOS file picker which does have that functionality.

Lumbard answered 10/5, 2009 at 14:9 Comment(0)
B
4

That is correct that the showOpenDialog method will not give you an option to create new folders. This is a usability thing as it does not really make sense to open something that does not exist. If you use the showSaveDialog there will be a button 'Make new Folder' or similar to that.

Barnhill answered 10/5, 2009 at 14:48 Comment(0)
Z
0
public static void main(String[] args) {
    JFrame frame = new JFrame();
    FileDialog d = new FileDialog(frame);
    d.setVisible(true);
}
Zen answered 31/8, 2009 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.