• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program throws a NullPointerException when we setNominalViewingTrasform

 
N Prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6216)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5981)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4583)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4413)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4413)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


any idea what i'm doing wrong?

cross posted at:
http://forums.sun.com/thread.jspa?threadID=5378445&CWP_SESSION=AQIC5wM2LY4SfcwHFyRvaLZyO1WbrgaAsBcDiUsyjA6SCq4%3D%40AAJTSQACMTcAAlMxAAIwMw%3D%3D%23

 
N Prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception has been resolved! Should i delete this thread? Just checking to be sure, so as to not waste anyone's time.

Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N Prasad wrote:The exception has been resolved! Should i delete this thread?
No.

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.
 
N Prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link to the page where the problem was solved :

http://ubuntuforums.org/showthread.php?t=1115869

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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
N Prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


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.


Moderator kindly remove this thread.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N Prasad wrote:Moderator kindly remove this thread.

Like Campbell said, we don't remove threads simply because they have been answered.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic