Scratch for Java

Stage::getMouseY()

Returns y coordinate of the mouse.

Examples

import org.openpatch.scratch.*;
 
public class StageGetMouse {
  public StageGetMouse() {
    Stage myStage = new Stage(600, 240);
 
    while (myStage.getTimer().forMillis(3000)) {
      var mouseX = myStage.getMouseX();
      var mouseY = myStage.getMouseY();
 
      myStage.display("X: " + mouseX + " Y: " + mouseY);
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new StageGetMouse();
  }
}
 

View on GitHub

Syntax

Java

.getMouseY()

Scratch

(mouse y)

Return

float

getMouseY()