Hi guys, I'm having a bit of a nightmare and hope someone can help. My problem is pretty simple. I'm trying to enable picking on two objects I have created. However, when I run the program and click onto one of them I get the following error in the terminal:
Why is this happening? I'm going crazy trying to work it out? Other programs that use picking do work on my computer so I know that's not the issue.
This is my Picking Code:
If it helps I can supply my main method too? The picking is supposed to happen on two buttons which I have created using the following code:
EEEK! Please help soon - I have to have this done by Friday
First of all you need to learn how to read a stack trace. It actually tells you exactly where your problem is. What it will not tell you is why. That's what you have to figure out.
If you look at your stack trace it says you have a NullPointerException. This means that you have an object that was never instantiated and you are trying to perform an operation on that object. If you look at the next line it tells you the exact line and file the Exception occurred, PickCanvas.java line 158. So from that you can see exactly what object is null. Then you have to figure out why it is null. setShapeLocation() was called from your method updateScene(), so I would start there.
Good tips from Barry, though obviously too late for you. It might have been more effective to not press us...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Barry Andrews: PickCanvas.java line 158. So from that you can see exactly what object is null.
Bummer that Sun didn't include the source for this class, or it would be a lot easier to track down the problem. This just reminds me of how glad I am that all of the standard java.* sources are available!
Ijla, thanks for that link! I suppose I should browse the other pages in that group as well. Kudos!