Scratch for Java

Window()

The window of a program: there is one, created first, and it shows one stage at a time.

public static void main(String[] args) {
  Window window = new Window(480, 360);
  window.setStage(new MyStage());
}

The constructor returns at once; the window runs on a thread of its own and the game ticks 60 times a second of game time. main may carry on, e.g. with stage.waitSeconds(\u2026) between steps.

Syntax

Java

new Window()
new Window(assets)
new Window(width, height)
new Window(width, height, assets)
Window()

Create Shareable URL

Select Sections