Embedding Processing in Java/Groovy
Is there a way to embed seamlessly Processing code into a Groovy application?
If it not exists, is there a way to do it in Java? I mean something to attach a component like a JFrame
with开发者_开发知识库 the content of a processing script having possibility to exchange data between both.
Here's a quick way to start mixing groovy and processing.org:
Add processing's core.java to classpath:
$ set CLASSPATH=C:\javaprograms\processing-1.2.1\lib\core.jar
Create a file named go.groovy, containing:
import processing.core.*;
public class MySketch extends PApplet {
void setup() {
size(480, 120);
smooth();
}
void draw() {
ellipse(mouseX, mouseY, 80, 80);
}
}
PApplet.main("--present", "MySketch" );
Run the script:
$ groovy go.groovy
精彩评论