Meaningless Drivel is fun!*
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
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()
 
 
subject: Exception: wrong parent for CardLayout