Scratch for Java

Stage::run()

This method is called every frame. This method has the some effect like a for ever loop in a when green flag clicked block.

Examples

import org.openpatch.scratch.*;

public class StageRun {
  class CustomStage extends Stage {
    public CustomStage() {
      super(600, 240);
      this.setColor(255, 0, 0);
    }

    public void run() {
      this.changeColor(0.5);
    }
  }

  public StageRun() {
    Stage myStage = new CustomStage();
    while (myStage.getTimer().forMillis(3000))
      ;
    myStage.exit();
  }

  public static void main(String[] args) {
    new StageRun();
  }
}

View on GitHub

Syntax

Java

void run()

Scratch

Return

void