I want to remove the "create directory" button from a JFileChooser that
I'm using as part of a larger panel, not using its "open dialog" methods.
I tried doing:
UIManager.put("FileChooser.readOnly", new Boolean(true));
but the result was:
java.lang.NullPointerException
at sun.swing.FilePane.addActionsToMap(FilePane.java:346)
at sun.swing.FilePane.createActionMap(FilePane.java:338)
at sun.swing.FilePane.<init>(FilePane.java:124)
at javax.swing.plaf.metal.MetalFileChooserUI.installComponents
(MetalFileChooserUI.java:185)
at
javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:
135)
at
javax.swing.plaf.metal.MetalFileChooserUI.installUI(MetalFileChooserUI.java:
123)
at javax.swing.JComponent.setUI(JComponent.java:624)
As a second-best alternative I'd settle for disabling the button. I tried:
((BasicFileChooserUI)fileChooser.getUI()).getNewFolderAction().setEnabled(fa
lse);
but the button was still enabled.
Any idea how to remove the button or at least to disable it? Please reply by
email to
sburoff@optonline.net if possible. Thanks very much.
Steve Buroff
hiwa - 25 Jan 2004 00:26 GMT
> I want to remove the "create directory" button from a JFileChooser that
> I'm using as part of a larger panel, not using its "open dialog" methods.
[quoted text clipped - 24 lines]
>
> Steve Buroff
setFileSystemView(new MyRestrictiveFileSystemView());