Closed GoogleCodeExporter closed 8 years ago
The answer is extends on the other class. Easy!
Original comment by fran.cla...@gmail.com
on 8 Mar 2010 at 11:07
The additional class file should look something like this:
// make sure it knows about Processing
import processing.core.PApplet;
// you don't actually extend anything, instead you will hand it a reference to
your PApplet
public class MyClass{
// this is the PApplet this class will be drawn on
PApplet parent;
// in the constructor you indicate which applet it will interact with
public MyClass(PApplet p){
parent = p;
}
A more fleshed out example is available at the end of the tutorial:
http://processing.org/learning/eclipse/
Original comment by Chris.Lonnen
on 31 May 2010 at 2:00
Oh, and whenever you want to call a Processing method from the new class, you
have to call it as a method of
the parent applet. For example, instead of:
line(30, 20, 85, 75);
you would use:
parent.line(30, 20, 85, 75);
Original comment by Chris.Lonnen
on 31 May 2010 at 5:25
Thanks Chris, i'll check it out.
Original comment by fran.cla...@gmail.com
on 1 Jun 2010 at 6:56
Thanks for helping out with this and thanks for posting the link to the
processing Eclipse page, Chris. We plan on getting documentation about this up
soon.
Original comment by maddpar...@gmail.com
on 6 Oct 2010 at 3:12
Original issue reported on code.google.com by
fran.cla...@gmail.com
on 4 Mar 2010 at 6:31