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.
IndexProgramming Questions & HelpSyntax Questions › using p5 methods in .java files
Page Index Toggle Pages: 1
using p5 methods in .java files (Read 270 times)
using p5 methods in .java files
Feb 28th, 2008, 10:17pm
 
hi there.
i had to create some files .java instead of .pde for some limit specs and since then i wasnt able to call processing functions like the "println" inside the .java files

i tried to import processing jar files but still did not work..
any one would tell me how to do it ?
thanks
Re: using p5 methods in .java files
Reply #1 - Feb 28th, 2008, 11:46pm
 
you can use processing.core.PApplet.println(), but to do this properly, I guess you have to pass the reference of your PApplet to your java class (say PApplet p) and call these 'processing' methods on p.

Code:
class Ext {
processing.core.PApplet p;
Ext(processing.core.PApplet p) {
this.p = p;
p.println("ext");
p.rect(10, 10, 40, 40);
}
}


In the main sketch:
Code:
new Ext(this); 

Re: using p5 methods in .java files
Reply #2 - Feb 28th, 2008, 11:51pm
 
oh, ok.
thank you!
Page Index Toggle Pages: 1