This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 3742
    
  16
showDialog expects two parameters. You're only passing one.


Joanne
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20077
    
  30

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 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
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: exception related to JFileChooser.showDialog and JFrame
 
It's not a secret anymore!