Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide the "choosable file filter" widget in a JFileChooser

How do I hide the "choosable file filter widget" in a JFileChooser? By "choosable file filter widget", I mean the panel below containing the words "File Format".

enter image description here

There's lots of info in the docs on how to modify the specific filters that appear in the widget, but I can't figure out how to hide it entirely.

I'm using the JFileChooser to select a directory, so the widget's unnecessary.

Any ideas?

EDIT

In the end I took Andrew Thompson's suggestion and set the filter chooser to display the text "directories only". In case it helps anyone, I used the following code:

        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.setFileFilter( new FileFilter(){

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

            @Override
            public String getDescription() {
                return "Directories only";
            }

        });
like image 378
dB' Avatar asked Dec 09 '12 00:12

dB'


1 Answers

Alternately fill it with a "Directories only" text. Then it will appear as the user expects it, with instructions.


File Format: Any Folder


like image 123
Andrew Thompson Avatar answered Oct 18 '22 09:10

Andrew Thompson