This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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

Win a copy of Elasticsearch in Action this week in the Big Data forum!
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: 3742
showDialog expects two parameters. You're only passing one.

Rob Spoor

Joined: Oct 27, 2005
Posts: 19911

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
wood burning stoves
subject: exception related to JFileChooser.showDialog and JFrame