I am putting a JFileChooser
in my program, but that only takes images. So I decided to add filters:
import javax.swing.*;
public c
You are using wrong ImageFiler class :-)
The ImageFilter from tutorial is not from java.awt package you are importing. This ImageFilter must implement javax.swing.filechooser.FileFilter.
Please check if there is other ImageFilter class defined in tutorial and use it.
Example of proper filefilter:
new JFileChooser().addChoosableFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
// TODO Auto-generated method stub
return f.getName().endsWith(".jpg");
}
@Override
public String getDescription() {
return "JPEG files";
}
});