Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Java 3D

 
Mike Smike
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good tips from Barry, though obviously too late for you. It might have been more effective to not press us...
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bummer that Sun didn't include the source for this class"

Yep... forgot about that.
 
Mike Smike
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic