Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FileFilter cannot be the superclass of ImageFilter?  RSS feed

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do I get this

The type FileFilter cannot be the superclass of ImageFilter; a superclass must be a class
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 FileFilter definitions, java.io.FileFilter is an interface, your class ImageFilter must implement FileFilter in the way your are using it.

Now, if you are using the JFileChooser, the setFileFilter method takes the other class javax.swing.filechooser.FileFilter which is an abstract class that does not implement java.io.FileFilter (Why it doesn't is beyound me) if you wish to use that, simply change your import statement and extends is fine.
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, it works now
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!