что не так с моим my, FileFilter говорит, что его нельзя istantiate
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.io.File;
public class fileChooser2 extends Object {
public fileChooser2() {
JFileChooser chooser = new JFileChooser();
// Note: source for ExampleFileFilter can be found in FileChooserDemo,
// under the demo/jfc directory in the JDK.
FileFilter filter = new FileFilter();
filter.addExtension("jpg");
filter.addExtension("gif");
filter.setDescription("JPG & GIF Images");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog(parent);
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
chooser.getSelectedFile().getName());
}
}
}