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 & HelpIntegration › including java class to processing
Page Index Toggle Pages: 1
including java class to processing (Read 1630 times)
including java class to processing
Mar 7th, 2009, 8:56pm
 
hi all,
i am including myclass.java to my main.pde program

in myclass.java iam using the loadimage function,
   planet=loadImage("/data/planet.png") ;

but it is giving me error:
"the function loadImage(string)does not exist"

i imported
import processing.core.*;
import processing.core.PApplet.*;

to my myclass.java file. but still the same error

can anyone tell me how to solve this prob?
Re: including java class to processing
Reply #1 - Mar 7th, 2009, 10:20pm
 
Why do you use a .java file? (there are plenty good reasons, I am just curious to see your...)

Anyway, Java files are not in the PApplet-derived class, unlike files with .pde extension. So they don't see PApplet methods, ie. all Processing functions!
The classical method is to provide the current PApplet instance to the class you have in the Java file, then call the Processing functions like: papplet.loadImage and such.
Page Index Toggle Pages: 1