Scratch for Java

Text()

A text on the stage: plain, in a box, or in a speech or thought bubble. Every sprite has one for say and think; texts of your own are added to a stage with stage.add(text).

Text score = new Text("Score: 0", -200, 160, 0);
score.setLayer(Layer.UI);
stage.add(score);

Texts are laid out from the font file at their nominal size, in stage units, so where lines break and how large boxes and bubbles are never depends on the window. They are drawn at the window's resolution, in front of the foreground layer (or in the UI layer), and stay sharp.

Syntax

Java

new Text()
new Text(text, x, y, width)
new Text(text, x, y, width, style)
Text()

Create Shareable URL

Select Sections