wood burning stoves*
The moose likes Beginning Java and the fly likes exception related to JFileChooser.showDialog and JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception related to JFileChooser.showDialog and JFrame" Watch "exception related to JFileChooser.showDialog and JFrame" New topic

exception related to JFileChooser.showDialog and JFrame

jaspreet atwal
Ranch Hand

Joined: Sep 05, 2007
Posts: 52

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 ]

Still Learing..
Joanne Neal

Joined: Aug 05, 2005
Posts: 3429
showDialog expects two parameters. You're only passing one.

Rob Spoor

Joined: Oct 27, 2005
Posts: 19653

Alternatively, you can use showOpenDialog or showSaveDialog, which only take a Component.

How To Ask Questions How To Answer Questions
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
As an aside, what you are getting is a compile time error, not an exception. Exceptions happen at runtime.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link: http://aspose.com/file-tools
subject: exception related to JFileChooser.showDialog and JFrame
Similar Threads
New Quiz Card Builder/Player for Exam Study
QuizCard class not found. (Head First Java 2nd Ed)
I just wrote my first program using JFileChooser
HeadFirst >>Chapter14:ArrayList Error
display image selected by Jfilechooser on the content pane of the frame