We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Drawing error (Read 1062 times)
Drawing error
Nov 6th, 2008, 7:58pm
 
I am writing a small application, and I'm now in the "get comfortable with eclipse and processing" stage. Here is my latest hangup:

Ive written a few classes, with one being the main class, and a pile of little ones to provide support for it. When I try to run the program I get:

Exception in thread "Animation Thread" java.lang.NullPointerException
at processing.core.PApplet.stroke(PApplet.java:7525)
at visualizer.BasicRectangle.drawMe(BasicRectangle.java:93)
at visualizer.ProcessingRun.draw(ProcessingRun.java:60)
at processing.core.PApplet.handleDraw(PApplet.java:1395)
at processing.core.PApplet.run(PApplet.java:1300)
at java.lang.Thread.run(Thread.java:613)

What I suspect is going on here is that in order to have the ellipse, rect, etc methods available, I have to make the classes extend PApplet. They all have a drawMe method that gets called in the main class. Does the fact that they are all extending PApplet cause any trouble?
Re: Drawing error
Reply #1 - Nov 27th, 2008, 2:34am
 
Did you solve that issue - I've just hit that snag?
Re: Drawing error
Reply #2 - Nov 27th, 2008, 2:43am
 
Ah!  The answer is not to extend all classes with PApplet.  The parent PApplet must be initialized in the constructors of other classes.

Detailed here in the Eclipse tut, but answer is for Netbeans too:
http://processing.org/learning/tutorials/eclipse/
Page Index Toggle Pages: 1