This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Program throws a NullPointerException when we setNominalViewingTrasform    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Program throws a NullPointerException when we setNominalViewingTrasform    " Watch "Program throws a NullPointerException when we setNominalViewingTrasform    " New topic
Author

Program throws a NullPointerException when we setNominalViewingTrasform

N Prasad
Greenhorn

Joined: Apr 04, 2009
Posts: 6
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

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

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

N Prasad,
Please read this
http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
N Prasad
Greenhorn

Joined: Apr 04, 2009
Posts: 6
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

Joined: Oct 13, 2005
Posts: 38467
    
  23
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

Joined: Apr 04, 2009
Posts: 6
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

Joined: Oct 13, 2005
Posts: 38467
    
  23
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

Joined: Apr 04, 2009
Posts: 6
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

Joined: Oct 27, 2005
Posts: 19675
    
  18

N Prasad wrote:Moderator kindly remove this thread.

Like Campbell said, we don't remove threads simply because they have been answered.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38467
    
  23
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.
 
jQuery in Action, 2nd edition
 
subject: Program throws a NullPointerException when we setNominalViewingTrasform