Processing in Eclipse

This article is the summary of http://processing.org/learning/eclipse/

0. Environment

Windows XP sp3

1.Steps

1.1 Install Java(JDK)

1.2 Install Processing

1.3 Download and install Eclipse

1.4 Create a new Java project

FILE --> NEW PROJECT and select "Java Project." Click next. Enter your project name (for example, "TestProcessing") and select "Finish."

1.5 Import the Processing libraries

FILE --> IMPORT --> GENERAL --> FILE SYSTEM
--> browse and find the Processing application, look inside the directory called "lib" --> Select the file "core.jar" --> FINISH
--> Right-click on the file and select --> BUILD PATH --> ADD TO BUILD PATH

1.6 Create a class and write your code

Create a class "MyProcessingSketch"
////////////////////////////////////////////////////////////
import processing.core.*;
public class MyProcessingSketch extends PApplet
{
  public void setup()
  {
    size(200,200);
    background(0);
  }
  public void draw()
  {
    stroke(255);
    if (mousePressed)
    {
      line(mouseX,mouseY,pmouseX,pmouseY);
    }
  }
}

////////////////////////////////////////////////////////////

1.7 Run as Java Application

////////////////////////////////////////////////////////////

  public static void main(String args[])
  {
    PApplet.main(new String[] { "--present", "MyProcessingSketch" });
  }

////////////////////////////////////////////////////////////

Note that the String "MyProcessingSketch" must match the name of your class (and if it is in a package, should include the package, i.e. packagename.MyProcessingSketch).

2. Reference

http://processing.org/learning/eclipse/

posted @ 2012-09-03 23:50  Yineng  阅读(556)  评论(0编辑  收藏  举报
Homepage: www.chenyineng.info
Copyright 2010 - 2014 Yineng Chen. All rights reserved.