I have a file system like so:
sketch
- sketch.pde
builtins
- button.pde
Where sketch.pde
is my main Processing sketch, and button.pde
is an external file containing various classes.
How do I access the classes from button.pde
? I'm guessing it's through an import
but I don't know if it's different in Processing than in Java.
I tried looking for an answer by looking through various open-source Processing projects, but all of the files were in one place, so no imports were required.
EDIT:
Apparently basic importing is impossible in Processing.
I have a mini-question then: I have another file system:
sketch
- sketch.pde
- builtins
- button.pde
Can I access button.pde
now? Or is it still impossible?
Edit: Mitchell's answer below shows that this is possible. Go read that answer!
One option is to use Processing as a Java library. You could then write some code that you export as a .jar
file, which you could then drag onto your sketch.pde
Processing editor and import the classes. In other words, you could create your own library that you then use in the Processing editor.
Another low-tech option is to copy the classes you want to use from button.pde
into new tabs in sketch.pde
.