Are there any predefined file filters for a JFileChooser?

John Zukowski

Apart from the accept all filter, until Java 6, there were no predefined filters. Java 6 introduces the FileNameExtensionFilter, allowing you to define one or more types of files for the user to select.

FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = ...;
fileChooser.addChoosableFileFilter(filter);
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact