How to make changes to PApplet class in processing.core.PApplet.java

I am a contributor to processing but dont have much experience.
I am working on an issue which needs changes to be made to some functions in PApplet.java for testing purposes.
But the changes i am making are not getting reflected in the Procesing IDE.
It's only after i do ant run then the changes are taking place but ant run deletes all the changes i am making in the file.
To clarify--
I first do ant run to build the code then
I changes the draw() method in PApplet.java to
public void draw() { // if no draw method, then shut things down //System.out.println("no draw method, goodbye"); System.out.println("Hello"); finished = true; } Then i open the Processing IDE and run it without any code but "Hello" doesn't get printed as it was supposed to. Then i do the ant run again and from now the "Hello" gets printed.
But this is the case only with the draw() function.When i make changes to some other function like change this function
public void text(String str, float x1, float y1, float x2, float y2) { if (recorder != null) recorder.text(str, x1, y1, x2, y2); g.text(str, x1, y1, x2, y2); }
to
public void text(String str, float x1, float y1, float x2, float y2) { System.out.println("Hi"); if (recorder != null) recorder.text(str, x1, y1, x2, y2); g.text(str, x1, y1, x2, y2); } the changes are not getting reflected as described above , but also on doing ant run the
System.out.println("Hi");
is getting deleted automatically. Thus i am not able to make any changes to the PApplet class.
Can someone please tell what i am doing wrong , or how other contributors work around this.

Comments

  • You're ignoring the line in PApplet.java that reads " // EVERYTHING BELOW THIS LINE IS AUTOMATICALLY GENERATED. DO NOT TOUCH!"

    draw() is overridden by your sketch, so if you run a sketch that has a draw() method, you'll never see that println().

    Depending on where/how the sketch is run, System.out.println() behavior will be different too: for instance, in the PDE it has to be intercepted so that it shows up in the console window.

    If you'd like to work on processing.core from inside Eclipse, the best option is to: create a project called 'processing-core' from the 'core' folder inside the Processing git repo. Then make a new project for your "work" sketch. In that project's settings, set the Java Build Path to include processing-core as a project. In the "work" project, make a single class that extends PApplet and has a main() that just calls PApplet.main("WorkSketchName"). Then you can edit things in processing-core and see the results when you run the work sketch.

  • edited February 2015

    Thanks for looking into this, i will try this method. I am having another similar problem. when i try to make some changes in any class in processing-java the changes do not take place when i run processing from within eclipse , for the changes to take place i have to use
    ant run
    But when i make any changes in any file in processing-app they are reflected when i run it from within eclipse. Is there any solution to this ?

Sign In or Register to comment.