wood burning stoves 2.0*
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
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: 3493
    
  13
showDialog expects two parameters. You're only passing one.


Joanne
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: exception related to JFileChooser.showDialog and JFrame