(Please use this thread for discussion of napplet and any problems/bugs encountered with it. napplet is neither a core nor a contributed library.)
About
napplet is a lightweight library that allows you to "embed" one Processing sketch inside another. This is potentially useful for a lot of things:
displaying data in different ways within the same window without having one display muck up another
creating a "control panel" in a portion of a sketch with buttons, etc. that control behavior elsewhere.
importing an existing sketch into a new one (source code transfers easily).
The API and coding is straightforward; an embedded sketch is simply enclosed in its own class that extends the NApplet class (which itself extends PApplet). The NApplet class contains setup() and draw() methods, global variables, etc, and in pretty much all ways behaves like a standalone PApplet (i.e., sketch).
To create and display NApplets, you simply create a NAppletManager object in the setup() method of the main sketch, and call NAppletManager.createNApplet() to create each sub-sketch and tell it where to draw in the main sketch. The NAppletManager then handles everything else "behind the scenes".
As an example,
here's a demo that runs eight of the example sketches that come with Processing. I wrote this demo in the PDE. Here's the code for the main sketch:
import napplet.*;
PFont mainFont;
void setup() {
size(800, 400);
mainFont = loadFont("ArialMT-18.vlw");
textMode(SCREEN);
textAlign(CENTER, TOP);
NAppletManager nappletManager = new NAppletManager(this);
Each sub-sketch was contained in its own tab in the PDE (you can see the source at the openprocessing.org link above). All of them were created by cutting-and-pasting the source code straight from the standalone sketches (and copying any necessary files from the sketch's data/ folder, of course.) The only change made to any of the sketches was adjusting the size() to fit in the gallery.
Sketches contained in NApplets have access to all of the variables and methods of the parent sketch, so they can potentially be parts of a larger application.
Useful Links