This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
My problem is that when i run this code it throws up the following error and i really don't know how to fix it:
Exception in thread �main� java.lang.IllegalArgumentException: wrong parent for CardLayout at java.awt.CardLayout.checkLayout(Unknown Source) at java.awt.CardLayout.first(Unknown Source) at Cineplex.<init>(Cineplex.java:170) at Cineplex.main(Cineplex.java:177)
Originally posted by Ben Zung: Also, you need to set your Container(c)'s layout to be CardLayout.
No, actually. In Tiger, JFrame.add() delegates to getContentPane().add(), and JFrame.setLayout() delegates to getContentPane().setLayout(), so this is just fine in that regard. If she's not using Tiger, then this will complain about the add() calls long before the NPE is thrown.