Search processing.org:

Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### class
Examples |
    // Declare and contruct two objects (h1, h2) from the class HLine
    HLine h1 = new HLine(20, 2.0);
    HLine h2 = new HLine(50, 2.5);

    void setup()
    {
      size(200, 200);
      frameRate(30);
    }

    void draw() {
      background(204);
      h1.update();
      h2.update();
    }

    class HLine {
      float ypos, speed;
      HLine (float y, float s) {
        ypos = y;
        speed = s;
      }
      void update() {
        ypos += speed;
        if (ypos > height) {
          ypos = 0;
        }
        line(0, ypos, width, ypos);
      }
    }
Description | Keyword used to indicate the declaration of a class. A class is a composite of data and methods (functions) which may be instantiated as objects. The first letter of a class name is usually uppercase to separate it from other kinds of variables. A related tutorial on Object-Oriented Programming is hosted from the Sun website.
Syntax |
    class ClassName {
      statements
    }
Parameters |
ClassName | Any valid variable name
statements | any valid statements
Usage | Web & Application
Related | Object

Updated on November 22, 2008 08:39:25pm PST