Scratch for Java

Stage::display()

A text container appears at the bottom of the stage and will only go away if the stage displays something else or after a given amount of time.

Examples

import org.openpatch.scratch.*;
 
public class StageDisplay {
  public StageDisplay() {
    Stage myStage = new Stage(600, 240);
    myStage.display(
        "Welcome! This is a longer text with auto line breaks! So if you write a long sentence it"
            + " should wrap to the next line and the height of the box should increase.",
        2000);
    myStage.wait(2000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new StageDisplay();
  }
}
 

View on GitHub

Syntax

Java

.display(text)
.display(text, milliseconds)

Scratch

dispaly [Hi!] display [Hi!] for (5) seconds

Parameters

Name Data Type Description
text String Text for the container.
milliseconds int Time for the container to stay.

Return

void

display()