• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception related to JFileChooser.showDialog and JFrame

 
jaspreet atwal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a code from HeadFirstJava. I get an Error for following lines of code and I do not understand this Error. Please advice:

Lines of Code:


Error when I compile this code:

[ April 24, 2008: Message edited by: jaspreet atwal ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
showDialog expects two parameters. You're only passing one.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively, you can use showOpenDialog or showSaveDialog, which only take a Component.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As an aside, what you are getting is a compile time error, not an exception. Exceptions happen at runtime.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic