Why does dispose method behave differently, when started from eclipse instead of Processing IDE ?

edited January 2015 in Questions about Tools

Hello,

when I run the sketch below in Processing and press the window close button or ESC, then the text "run dispose method" is printed. In contrast to that, when I run the code in Eclipse as application, then the text output happens only, if I press ESC. The click on the window button close the program, but the text does not appear.

Why is the behavior different ?

Software versions: Processing (2.2.1), Eclipse (Luna), Win 7

I used the decription in creativeapplications.net/processing/craft-your-processing-sketches-in-eclipse/ to use the processing libaries in Eclipse. This does work without problems for many programs.

Processing test code:

void setup() {
  size(200, 200);

  registerMethod("dispose", this);

  println("Start");
}

void draw() {
}

void dispose() {
  println("run dispose method");
}

Eclipse Test Code:

package test;

import processing.core.*; 

public class Test_Dispose extends PApplet {

public void setup() {
  size(200, 200);

  registerMethod("dispose", this);

  println("Start");
}

public void draw() {
}

public void dispose() {
  println("run dispose method");
}

static public void main(String[] passedArgs) {
    String[] appletArgs = new String[] { "test.Test_Dispose" };
    if (passedArgs != null) {
      PApplet.main(concat(appletArgs, passedArgs));
    } else {
      PApplet.main(appletArgs);
    }
  }
}

Thanks for any hints.

Answers

  • edited January 2015 Answer ✓
    • Just a guess: PDE (Processing's IDE) communicates w/ the running window sketch via LAN.
    • Perhaps there's some extra feedback when we close that window via its X close button.
    • Have you tried to export the sketch in PDE rather than Eclipse and see how it behaves? :-/
  • edited January 2015

    I have tried the exported sketch now. It works like the program started from Eclipse.

    Sorry.

    With this information it lookslike this question: code-supposed-to-run-on-exit-does-not-work-when-exported

    Are there new informations about that ?

Sign In or Register to comment.