Found a simple way to integrate Pure Java Processing work flow into Intellij Idea

edited December 2015 in General Discussion

1: Create a Standard Java Project in Intellij Idea.
2: Open Settings from File -> Settings.
3: Navigate to Editor > Files and Code Template.
4: Now create a new Code Template by pressing the green '+' sign and name your template anything you want.
5: Now paste everything shown below into the text area.

import processing.core.PApplet;

public class ${NAME} extends PApplet {
    public void setup(){

    }

    public void draw() {

    }

    public void settings() {

    }

    static public void main(String[] passedArgs) {
        String[] appletArgs = new String[]{"--window-color=#666666", "--stop-color=#cccccc", "${NAME}"};
        if (passedArgs != null) {
            PApplet.main(concat(appletArgs, passedArgs));
        } else {
            PApplet.main(appletArgs);
        }
    }
}

6: That's about it, now you can create new Processing Sketch using this file by clicking on File -> New -> [Your Processing Template Name]

If you have any doubts please post them below

Comments

  • Is Intellij Idea an ide? Is it better than p3x ?

  • Do I have to put my own classes outside public class ${NAME} ?

  • edited December 2015

    @Chrisir Yes it is a Java IDE and No you don't have to put your own class, it auto populates those field with the name of your file.

  • Okay but my own classes Car etc.?

  • edited March 2016

    Update: Scratch that. Works fine.

    (it was caused by other library I've included).

    Hello! Using these steps, I can create PApplet extending classes and compile them, however they don't run :( The sketch path is not set. java.lang.RuntimeException: Files must be loaded inside setup() or after it has been called.

    What could be done?
Sign In or Register to comment.