Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT How to select default FileFilter when creating a JFileChooser dialog?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
How to select default FileFilter when creating a JFileChooser dialog?
1 Answer(s)      2 years and a month ago
Posted in : Swing AWT


Hi,

In my swing application I want my application to open the my specific directory say "c:\mydirectory" when browse button is clicked.

How to select default FileFilter when creating a JFileChooser dialog?

Thanks


Advertisement
View Answers

August 21, 2012 at 12:48 PM


Hi,

Following code can be used:

JFileChooser c = new JFileChooser();
c.setFileSelectionMode(c.DIRECTORIES_ONLY);
String defaultDirectoryPath = "C:\\mydirectory";
c.setSelectedFile(new File(defaultDirectoryPath));

Thanks



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com