This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

exception related to JFileChooser.showDialog and JFrame

jaspreet atwal
Ranch Hand

Joined: Sep 05, 2007
Posts: 52
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 ]

Still Learing..
Joanne Neal
Rancher

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


Joanne
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ilja Preuss
author
Sheriff

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
 
 
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