Scratch for Java

Timer::afterMillis()

Returns true after a given amout of milliseconds.

Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.timer.Timer;
 
public class TimerAfterMillis {
 
  public TimerAfterMillis() {
    Stage myStage = new Stage(600, 240);
    Timer myTimer = new Timer();
    while (true) {
      myStage.display("Waiting...");
      if (myTimer.afterMillis(3000)) {
        break;
      }
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new TimerAfterMillis();
  }
}
 

View on GitHub

Syntax

Java

.afterMillis(millis)

Scratch

after () millis :: boolean

Parameters

Name Data Type Description
millis boolean Milliseconds to wait for returning true

Return

boolean

afterMillis()