views:

130

answers:

2

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.

+2  A: 

See this link for details on using imbedding a processing PApplet into a java program. See this faq for more details on interoperating with Java. All the information should apply to Groovy as well.

Jared
A: 

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
Andy Dean