- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to enable the display of hidden files in a JFileChooser in Java?
Set the following to FALSE to enable the display of hidden files −
JFileChooser file = new JFileChooser(); file.setFileHidingEnabled(false);
The following is an example to enable the display of hidden files in a JFileChooser −
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); int res = file.showOpenDialog(null); if (res == JFileChooser.APPROVE_OPTION) { java.io.File f = file.getSelectedFile(); System.err.println(f.getPath()); } } }
The output is as follows. This displays the hidden files and directories.
Above, the “amit.txt” abd “desktop.ini” were hidden files and are now visible.
- Related Articles
- How to enable multiple selections in a JFileChooser Dialog with Java?
- How to display files/folders including hidden files/folders in PowerShell?
- How to list the hidden files in a directory in Java?
- How to list out the hidden files in a Directory using Java program?
- How to create FileFilter for JFileChooser in Java and display File Type accordingly?
- How to get Directories from JFileChooser in Java
- How to ignore hidden files using os.listdir() in Python?
- How to copy readonly and hidden files/folders in the PowerShell?
- How to get only hidden files and folders in PowerShell?
- Check if hidden files are displayed in the FileChooser or not in Java
- Working with Hidden Files in Linux
- How to list non-hidden files and directories in windows using Python?
- How to remove hidden files and folders using Python?
- How to get hidden files and folders using PowerShell?
- How to delete hidden files and folders using PowerShell?

Advertisements