Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forbid directory name editing in JFileChooser?

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?

like image 915
Rogach Avatar asked Aug 31 '11 08:08

Rogach


1 Answers

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.

like image 151
mwuersch Avatar answered Sep 29 '22 11:09

mwuersch