Scratch for Java

Scratch for Java (Version 5.8.0)

Scratch for Java lets you keep everything you learned in Scratch β€” sprites, costumes, the stage, move, say, when key pressed β€” and write it as Java instead of dragging it.

It is built for the moment a class outgrows Scratch but is not ready to start Java from an empty file.

import org.openpatch.scratch.*;
 
public class MyStage extends Stage {
  public MyStage() {
    Sprite bunny = new Sprite();
    bunny.addCostume("bunny1_stand");
    this.add(bunny);
  }
}

That is a complete program, and it needs no image files: 922 pictures and 266 sounds are built in.

Here is one running. Press β–Ά β€” then change a number or a costume name and start it again, it is a real editor. Every tutorial and every method in the documentation comes with a box like this one.

I'm learning

  1. Your first program: ten minutes, right here in the browser, nothing to install.
  2. Seven tutorials: from a walking alien to a game with a title screen, one new idea at a time.
  3. Scratch β†’ Java cheat sheet: which Java line replaces which block.
  4. It doesn't work!: the most common mistakes and how to fix them.
  5. Glossary: class, object, method and the other new words.

Then pick a picture from the built-in sprites and sounds, look at the examples, or look up any method in the documentation. Every method there shows the Scratch block it replaces and an example you can run.

I'm teaching

Deutschsprachiges Material findest du in Hyperbook Informatik: den Lernpfad Grundlagen der Programmierung mit Java und die Spielwerkstatt, in der du ΓΌber ein ganzes Schuljahr dein eigenes Spiel entwickelst.

Seeing it side by side

The following video shows a Scratch project and a similar BlueJ project using the Scratch for Java library.

If you want to compare it yourself, you can take a look inside both projects:

Special Thanks

The Scratch for Java library is profiled using Java Profiler

Java Profiler

Welcome

Create Shareable URL

Select Sections