The following code is supposed to create a Cylinder object and add it to the scenegraph. The radius and height for the Cylinder object are provided using a dialog box, so when the input is entered a Cylinder with the set parameters should appear on the canvas.
But when i run this code it throws the following exception.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Animapp.actionPerformed(Animapp.java:106)
N Prasad wrote:The exception has been resolved! Should i delete this thread?
Welcome to JavaRanch
We don't have a policy of deleting threads; this thread might be useful to somebody else who has a similar problem in the future. It would be a good idea, however, briefly to tell us what the problem was and how it was corrected (or provide a link to other discussion with the solution). please.
Joined: Apr 04, 2009
Here's a link to the page where the problem was solved :
And sorry about the cross-postings. I thought the problem may have something to do with Java3D. So i posted the same query on a forum devoted to Java3D as well. The problem is that you don't have a lot of very active members on the Java3D forums, to respond to the queries. And there aren't enough useful tutorials (or i couldn't get my hands on them!)
A quick question... it seems I've posted this thread in the wrong section of this forum. Is there anyway I could move it to the "Other Java APIs" section? The code doesn't yet do quite what I expected it to. Should I accordingly edit the query and post it in the other section. Or would that be considered spamming?
Joined: Oct 13, 2005
Thank you for the solution; lots of people get NullPointerExceptions for the same reason.
Please don't edit the original post; if you change the original and the answers are unchanged, the thread will be very confusing to read.
And you can't move the threads; we moderators can, but I prefer to leave that to Maneesh and Rob who "lead" this forum, if possible.
I think maybe a good way to proceed would be to past a new query in the "other APIs" forum saying what the problem is, and quoting a link to this thread to say where the code is.
Joined: Apr 04, 2009
It seems there was some problem with my Java3D installation. I uninstalled and reinstalled Java3D and now the same code is working fine. Thanks for your time and sorry for this post.
No need to be sorry; we are happy to see people get their problems sorted out. As I said before, this thread might be useful if somebody else has the same problem in the future, so we don't usually delete threads.
subject: Program throws a NullPointerException when we setNominalViewingTrasform