The moose likes Swing / AWT / SWT and the fly likes Exception:  wrong parent for CardLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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: 127

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{


Life is like a day. If the day is of no use, neither a month or a year.
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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Exception: wrong parent for CardLayout
 
Similar Threads
Switching between the frames
JPanels with different content should have the same size
IllegalStateException in JSP
problem in erasing panel
Frames