Search code examples
javaswingfilesystemsjfilechooserdotfiles

How to make Java JFileChooser display all files including ones starting with a dot


By default JFileChooser does not display files with names starting with at dot. How to make it display all files?

Here is what I have tried (did not help):

    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(new FileFilter() {

        @Override
        public boolean accept(File f) {
            return true;
        }

        @Override
        public String getDescription() {
            return "All Files";
        }
    });

Thanks.


Solution

  • JFilechooser setFileHidingEnabled()

    chooser.setFileHidingEnabled(false);
    

    How to Use File Chooser