Skip to content
Advertisement

Use processing in Java application

I downloaded processing from http://processing.org. How is it possible to use porcessing in my Java application. I want drawing stuff depending on the logic in my Java application. To avoid the drawing in Java I want to use processing instead.

Advertisement

Answer

Piece of cake,

First,

In your IDE (eg Netbeans) first include the processing jar in your build, put it some place your program can find it. For example if you use maven just add the dependancy:

JavaScript

Second,

Add a main class to your program this can be very simple. You just need to reference the class where your code will be:

JavaScript

Lastly,

Add your new class with the package name as you gave in quotes above. The only thing to remember is this class must (1) import processing.core.PApplet (2) extend PApplet (3) implement public void draw and public void setup

Eg:

JavaScript

Snippets above are based on this example project which runs Processing.org code in a java application.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement