This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Exception:  wrong parent for CardLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception:  wrong parent for CardLayout" Watch "Exception:  wrong parent for CardLayout" New topic
Author

Exception: wrong parent for CardLayout

Allen Bandela
Ranch Hand

Joined: Feb 16, 2006
Posts: 128

Hi everybody,
I am creating a GUI for an application. I am setting the frame with CardLayout. But, I am getting runtime exception "java.lang.IllegalArgumentException: wrong parent for CardLayout"
while executing the cardLayout.show(Container parent, Object constraints) method. I made sure the parent was the one which has the card layout set to it. Please help.
The program is below.
public class LoginGUI implements ActionListener{
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
LoginGUI.this.exams
should be
LoginGUI.this.exams.getContentPane()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception: wrong parent for CardLayout
 
jQuery in Action, 3rd edition