http://pastie.org/4372510 – Click this link for the code. (Didnt post it here to keep question clean)
I was recently trying to create a simple Java program in order to learn cardLayout.
I wanted this program to show a JLabel saying “Label1” in the beginning.
When the user clicks the label, I wanted to switch cards. i.e show Label2.
"Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at potpie.changeLabel(potpie.java:34)"
This is the error that I am getting. It says something is wrong with the line 50 in the code I have pasted.
I cant seem to figure out what is wrong.
Is calling changeLabel on a new potpie (I hate your class names and method names, by the way, they are meaningless), not on the one that was instantiated (with a call to .koko) in main.