Scratch for Java

Text()

The Text class represents a text object that can be displayed on the stage. It provides methods to set the text content, position, size, style, and alignment. The text can be displayed in various styles such as plain, speech bubble, or box. The text can be associated with a sprite and displayed relative to the sprite's position. Example usage:

Text text = new Text("Hello, World!", 100, 100, 200);
 text.setStyle(TextStyle.SPEAK);
 text.setBackgroundColor(255, 255, 255);
 text.setTextColor(0, 0, 0);
 text.setStrokeColor(0, 0, 0);

Examples

View on GitHub

Syntax

Java

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

Static Fields

Name Type Description
SPEAK_BUBBLE_MAX_LIMIT int SPEAK_BUBBLE_MAX_LIMIT is the maximum width of the speech bubble.
SPEAK_BUBBLE_MIN_LIMIT int SPEAK_BUBBLE_MIN_LIMIT is the minimum width of the speech bubble.
Text()

Create Shareable URL

Select Sections