• Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructor Jframe in class Jframe cannot be applied to given types  RSS feed

 
John Matczak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have this line of code...



And when I compile it gives me...

error: constructor Jframe in class Jframe cannot be applied to given types;
ioexception11.addChoosableFileFilter(new Jframe());
 
Piet Souris
Master Rancher
Posts: 2044
75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi John,

assuming that 'ioexception11' is a JFileChooser, then the method 'addChoosableFileFilter'
requires a 'FileFilter' as parameter, not a JFrame. Have a look at the API of a
JFileChooser: http://docs.oracle.com/javase/7/docs/api/

Greetz,
Piet
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
…and welcome to the Ranch
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet Souris wrote:assuming that 'ioexception11' is a JFileChooser, then the method 'addChoosableFileFilter'
requires a 'FileFilter' as parameter, not a JFrame. Have a look at the API of a
JFileChooser: http://docs.oracle.com/javase/7/docs/api/

Though if that assumption is correct...why on Earth is the variable called ioexception11? It's not a great name for an IOException object, but at least that would make some sense.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet Souris wrote:assuming that 'ioexception11' is a JFileChooser, then the method 'addChoosableFileFilter'
requires a 'FileFilter' as parameter, not a JFrame.

Except he's not passing a JFrame but a Jframe, which, going on the other names he's used, may be a class that extends FileFilter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!