public class DocFilter extends FileFilter {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = Utils.getExtension(f);
if (extension != null) {
if (extension.equals(Utils.doc) ||
extension.equals(Utils.docx) )
{
return true;
} else {
return false;
}
}
return false;
}
//The description of this filter
public String getDescription() { return "Just Document Files"; }
}
Netbeans コンパイラは、上記のコードに対して「No interface expected here」というエラーで警告しました
何が問題だったのか誰にも分かりますか?? 「extends」を「implements」に変更してみましたが、うまくいきませんでした。
そして実装に変更すると、次のコードが機能しなくなり、
chooser.addChoosableFileFilter(new DocFilter());
そして、このエラーで、
「クラス javax.swing.JFileChooser のメソッド addChoosableFileFilter は、必要な特定のタイプに適用できません: javax.swing.filechooser.FileFilter」
誰でもこれについて助けることができますか?ありがとう..