Quick question: How to destroy a PApplet without terminating the entire JVM?
in
Integration and Hardware
•
2 years ago
I launch processing sketches from MAX/MSP & Matlab.
To do this, I instantiate a Frame (AWT) and add the PApplet as a component.
Then I init() and start() the applet, make the frame visible, and do a redraw().
Now - how do I destroy the PApplet?
Calling destory() calls stop() which calls exit at some point and terminates MAX/MSP or Matlab.
There these other methods like dispose() and delete() - but I have no clue what they are doing.
Please help me out, as I might be creating and destroying a lots of processing sketches!
Thanks!
- public static void show(PApplet aSketch)
- { sketch = aSketch;
- frame = new Frame(sketch.toString());
- /* do layout stuff */
- frame.add(sketch);
- /* do frame stuff */
- frame.addWindowListener(new WindowAdapter(){
- public void windowClosing(WindowEvent we){
- frame.dispose();
- frame = null;
- /* HOW TO DESTROY THE SKETCH HERE??? */
- }
- });
- //initialize applet, start everything...
- sketch.init();
- sketch.start();
- frame.setVisible(true);
- sketch.redraw();
- }
1