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);

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.
DEFAULT_FONT_SIZE int DEFAULT_FONT_SIZE is the default font size for the text.
DEFAULT_FONT String DEFAULT_FONT is the default font for the text.
FONT_SIZES int[] FONT_SIZES is an array of font sizes that can be used for the text.
SMOOTHING boolean SMOOTHING is a boolean flag that indicates whether text will be smoothed
Text