How do I use processing.core in a .java?

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

Tagged:

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().

  • ..., if they are abstract methods...

    You mean static: https://Processing.org/reference/static.html ;)

  • edited June 2016

    ... you can call them like PApplet.dist().

    W/o using import processing.core.PApplet.*; we're gonna need its full qualified name: processing.core.PApplet.dist().

  • edited June 2016

    And a cool trick: w/ import static processing.core.PApplet.*;, we can directly use dist() and other PApplet's static methods & fields w/o prefixing them w/ PApplet.. :ar!

Sign In or Register to comment.