It looks like I created a field twice, so it thought it was a local variable. Please disregard.
Hi all,
I'm very green at this (first post).
I am trying to do a little
applet that shows a projectile flying through the air. There is an Applet Form, a few sliders, and a JPanel.
The sliders and combo box are working, and the panel loads and shows the x-y coordinate system with the projectile at (0,0). The problem starts when I hit the "run" button, which launches run(). I think I may have a tread problem but don't know what these errors are. Any help would be greatly appreciated!! (Code is below the errors)
Scroll down to the bolded text to see the runButton code. Exception in
thread "AWT-EventQueue-1" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1010)
at java.awt.Container.add(Container.java:928)
at javax.swing.JApplet.addImpl(JApplet.java:300)
at java.awt.Container.add(Container.java:348)
at ProjectileForm3.runButtonActionPerformed(ProjectileForm3.java:305)
at ProjectileForm3.access$900(ProjectileForm3.java:9)
at ProjectileForm3$9.actionPerformed(ProjectileForm3.java:149)
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:6134)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5899)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Component.dispatchEvent(Component.java:4331)
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)
[ November 26, 2008: Message edited by: Jeff Ciaccio ]
[ November 26, 2008: Message edited by: Jeff Ciaccio ]
[edit]Add code tags. CR[/edit]
[ November 26, 2008: Message edited by: Campbell Ritchie ]
[ November 26, 2008: Message edited by: Jeff Ciaccio ]