Question

How filter the files by extensions (in the screen), like this example

thanks, celso.

Was it helpful?

Solution

You can use FileNameExtensionFilter to filter certain file extension in JFileChooser. The API doc for it gives a short example:

FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter(filter);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top