From: rossum on
On Sun, 14 Feb 2010 08:34:57 -0800 (PST), Amr
<fromwindowstolinux(a)gmail.com> wrote:

>Thank you very much for the reply.
>it solved part of the problem.
>now i can't move to the next card. and i get this error:
>
>Exception in thread "AWT-EventQueue-0"


This stuff has the latest first.

>java.lang.IllegalArgumentException: wrong parent for CardLayout
You have an IllegalArgumentException. Something about the CardLayout
you are passing.

> at java.awt.CardLayout.checkLayout(CardLayout.java:404)
It is probable that the CardLayout being referenced in this method is
faulty.

> at java.awt.CardLayout.show(CardLayout.java:526)
The probable faulty reference is within the code of the show() method.

> at DayEleven.SurveryWizard.actionPerformed(SurveryWizard.java:
>50)
This is where the problem is in your code. All previous source line
numbers were in Java code.

[snip rest of error]

>
>
>and it says,the error is in the last line of this code snippet:
> public void actionPerformed(ActionEvent evt){
> currentCard++;
> if(currentCard>=ask.length){
> System.exit(0);
> }
> cards.show(this,"Card "+currentCard);
One of these two parameters is probably faulty. I assume that the
second parameter "Card " + currentCard is a string so that is unlikely
to be the problem, though it is possible.

Your first parameter is 'this' Check what type 'this' is. Check what
type the show() method is expecting as its first parameter.

As I read your code fragment, 'this' refers to an instance of the
class that contains the actionPerformed() method. That may not be the
right type for show().

rossum

> }
>
>
>thank you very much for your time.