Tutorialspoint

1 Answer
Ankith Reddy

The result FALSE for is FileHidingEnabled() means the hidden files are displayed in the FileChooser. 

The following will display FALSE since file isn’t hidden −

JFileChooser file = new JFileChooser();
file.setMultiSelectionEnabled(false);
file.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
file.setFileHidingEnabled(false);
boolean res = file.isFileHidingEnabled();

Above, at first, we have displayed the file by setting hidden to be FALSE −

file.setFileHidingEnabled(false);

The following is an example −

Example

package my;
import javax.swing.JFileChooser;
public class SwingDemo {
   public static void main(String[] args) {
      JFileChooser file = new JFileChooser();
      file.setMultiSelectionEnabled(false);
      file.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      file.setFileHidingEnabled(false);
      boolean res = file.isFileHidingEnabled();
      System.out.println("File are hidden in the FileChooser? "+res);
   }
}

Output

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.