Scratch for Java

Stage()

A stage: one screen of a program, with its backdrops, sprites, texts and pens, and code that runs every tick in run(). The window shows one stage at a time (window.setStage(new MyStage())).

public class MyStage extends Stage {
  public MyStage() {
    this.addBackdrop("forest", "assets/forest.png");
    this.add(new Cat());
  }
}

A stage needs the window to exist, since the window sets its size: create the window first.

Syntax

Java

new Stage()
Stage()

Create Shareable URL

Select Sections