开发者

Embedding Processing in Java/Groovy

开发者 https://www.devze.com 2022-12-14 17:46 出处:网络
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开发者_开发知

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
0

精彩评论

暂无评论...
验证码 换一张
取 消