To browse directories in JFileChooser, users use double-click. The problem is, if they click not fast enough, file chooser thinks they want to edit directory name, and it is very annoying. Is there a way to disable directory name editing?
How to forbid directory name editing in JFileChooser?
Asked Answered
By doing this, you'll annoy users who can double-click and want the file choser to have this capability, to make the users unable to double-click a bit more happy (because they still have to double-click to open the folder). –
Lightship
@JB Nizet - yes, I understand. But on this specific project, they do not need it, they are annoyed, and accidental edit of directory name would lead to disaster. –
Sulfathiazole
If it's such a disaster if some directory name is changed, shouldn't it be forbidden at the OS level? –
Lightship
@JB Nizet - good idea! But it is not my field, so I would tell their admin. –
Sulfathiazole
@JB Nizet - and forbidding editing of dir name by permissions does not stop file chooser from going to edit mode. –
Sulfathiazole
You could set the file chooser to be read only, if need be:
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
Unfortunately, that also removes the 'new folder' button, if I am correct.
Yes, it removes 'new folder', but it is no problem for me. Thanks! –
Sulfathiazole
© 2022 - 2024 — McMap. All rights reserved.