simple help about JFileChooser



here is a method i writte in java
public void aaa(){
JFileChooser chooser=new JFileChooser();
chooser.setFileFilter(new FileFilter() {//
setFileFilter(javax.swing.Filechooser.filefilter)
//in javax.swing.JFileChooser can't applied to (<anonymous
java.io.fileFilter>)
public boolean accept(File f) {
String fileName = f.getName().toLowerCase();
return fileName.endsWith(".txt") || f.isDirectory();
}
public String getDescription() {
return "Text Files";
}
});
chooser.showOpenDialog(this);
}

when used in some class it run well.but when it appear in some
class,it goes wrong .the IDE tell me that
setFileFilter(javax.swing.Filechooser.filefilter)
//in javax.swing.JFileChooser can't applied to (<anonymous
java.io.fileFilter>).
who can tell me what's that means. and why that happen
.



Relevant Pages

  • simple help about JFileChooser
    ... JFileChooser chooser=new JFileChooser; ... chooser.setFileFilter(new FileFilter() {// ... public boolean accept{ ... public String getDescription() { ...
    (comp.lang.java.programmer)
  • Re: simple help about JFileChooser
    ... public void aaa{ ... JFileChooser chooser=new JFileChooser; ... public String getDescription() { ... There are two flavours of FileFilter. ...
    (comp.lang.java.help)
  • Re: simple help about JFileChooser
    ... chooser.setFileFilter(new FileFilter() { ... public boolean accept{ ... String fileName = f.getName.toLowerCase; ... public String getDescription() { ...
    (comp.lang.java.programmer)
  • Re: simple help about JFileChooser
    ... chooser.setFileFilter(new FileFilter() { ... public boolean accept{ ... String fileName = f.getName.toLowerCase; ... public String getDescription() { ...
    (comp.lang.java.programmer)
  • Re: simple help about JFileChooser
    ... public String getDescription() { ... As you probably know by now there are two types named FileFilter. ... the IDE ...
    (comp.lang.java.programmer)