We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So I have import a few .java classes from another project, but I am unable to use function such as dist() and artan2() which I can use in my main pde tab, but not in my .java tabs
I thought writing "import processing.core.*" would work, but no
Answers
Are you in processing or in eclipse or something. Else? Maybe if you share your code its easier to help? :)
You either need to call them from an instance of a PApplet or, better, if they are abstract methods (like dist and atan2 if I'm not mistaken) you can call them like
PApplet.dist()
.You mean
static
: https://Processing.org/reference/static.html ;)W/o using
import processing.core.PApplet.*;
we're gonna need its full qualified name: processing.core.PApplet.dist().And a cool trick: w/
import static processing.core.PApplet.*;
, we can directly use dist() and other PApplet'sstatic
methods & fields w/o prefixing them w/PApplet.
. :ar!