Loading...
Logo
Processing Forum
I'm fairly new to processing (about 2 months) and I'm from a C/C++ background so I have no idea about java.

I think I've just about got to grips with all the basics & how to use most of the functions given in the reference, however every once in a while when perusing these forums I come across ALOT of things that aren't in the reference or learning topics. One of these is PApplet.

I understand creating a class that extends PApplet gives you access to the methods & members of PApplet which are 'hidden' but the question is;

where can I find the methods & functions of PApplet and more importantly is there a tutorial somewhere giving examples of why you might want to extend PApplet?

The main reason I'm interested in PApplet is because I would like to implement something like this ( https://forum.processing.org/topic/multiple-papplet-on-android) for creating multiple screens so that you can use the back button easily to go back to the previous screen in android mode + it just seems like a very elegant way to organise code. (or is there an easier way to do this?)

More questions;

Why extend PApplet, why not just create an object of PApplet and use the methods?

Where does this come from; ' gNotificationManager' which is on line 14 in the code (see above link). Unfortunately I can't remember some of the other 'alien' keywords & functions that I've found while looking through the forums but I'm guessing some of them are from pure java code? and maybe some from android sdk libraries? or even contributed libraries since people post snippets of code sometimes and not the full code.

Thanks alot.

Replies(2)

You can just create an instance of PApplet and call its methods, but it doesn't make any sense to do so- what would you call? What should get displayed?

Instead, you extend PApplet and override certain methods to handle display, user interaction, etc. Actually this is what you're doing by default when you write a sketch, Processing just magics that away from you.

To view the source, just check out the "Download Source" link from the download page: http://processing.org/download/
If you use Import Applet <Ctrl + E>, Processing IDE generates a .java file.
Then you can peruse that to study how Processing transforms its language code into a true Java one.

Also, see the last comments in this thread -> Make Binary Tree return...