*
The moose likes Other JSE/JEE APIs and the fly likes Help with Java 3D Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Help with Java 3D" Watch "Help with Java 3D" New topic
Author

Help with Java 3D

Mike Smike
Ranch Hand

Joined: Aug 25, 2004
Posts: 33
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

Thanks oh wonderous java people

Mike

[ January 19, 2005: Message edited by: Mike Smike ]

EDIT: Lasse edited thread subject
[ January 28, 2005: Message edited by: Lasse Koskela ]
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

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.

Hope it helps!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
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!
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

"Bummer that Sun didn't include the source for this class"

Yep... forgot about that.
Mike Smike
Ranch Hand

Joined: Aug 25, 2004
Posts: 33
Thanks for the advice guys! I found that the problem was the Canvas3D object - I had re-initialised it at some point, so it was infact empty when I added it to the universe.

Anyway, I managed to get the work done on time

Thanks for the help

Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with Java 3D
 
Similar Threads
Java3D Animation problem (Loads up components, then skips animation. No errors. Less than 75 lines.)
Problem with lighting in Java3D
Help needed to run a Java3D program!
Problem with lighting in Java3D
Error (compile time) for JAVAX package