I am trying to set up a file filter in Swing that
looks for filenames beginning with certain characters. For example,
Credit filenames beging with "ECS" and debit with "ED". I have two
Jbuttons in my Frame which allow to select either ALL credit files or
ALL debit files. My program is attached. The code throws out a compile error.
public class OnlyCredit {
private
String extension;
private String description;
public OnlyCredit(String extension,String description) {
this.filter = new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().startsWith("ECS");
}
@Override
public String getDescription() {
return description;
}
};
this.extension = extension;
this.description = description;
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
FileFilter filter;
OnlyCredit(String ext, String desc) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}