the basic idea is that you can call methods from a menu that will draw things in the applet (kind of like a Gimp based on processing).
The hosting application is made using Swing, the menu bar is a JMenuBar, containing "JMenu"s and "JMenuItem"s.
You can see below what the application looks like, the big Grey area is the Processing Frame (using the code given in the PApplet doc).
here is the code I use to embbed the applet :
Code:
mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel,BoxLayout.Y_AXIS));
appletView = new EmbeddedApplet();
appletView .setMinimumSize(new Dimension(640,480));
appletView .setMaximumSize(new Dimension(640,480));
appletView .setPreferredSize(new Dimension(640,480));
appletView .init();
mainPanel.add(artspaceView);
and my EmbeddedApplet class :
Code:
public class EmbeddedApplet extends PApplet {
public void setup() {
size(640, 480);
noLoop();
}
public void draw() {
// apply things in the command queue
}
public void mousePressed() {
// do something based on mouse movement
redraw();
}
}