B4J Question moveMouse

magarcan

Active Member
Licensed User
Here is my code:
B4X:
Dim robot As JavaObject
robot.InitializeNewInstance("javafx.scene.robot.Robot", Null)
robot.RunMethod("mouseMove", Array As Object(250, 250))
java.lang.RuntimeException: Method: mouseMove not matched.

Any idea why?

PD: using open jdk 11
 

stevel05

Expert
Licensed User
Take a look at the documentation: https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/robot/Robot.html

mouseMove requires parameters of type Double, Passing 250, passes an Int variable. Passing 250.0 passes the parameter as a double so this works:

B4X:
Dim robot As JavaObject
    robot.InitializeNewInstance("javafx.scene.robot.Robot", Null)
    robot.RunMethod("mouseMove", Array As Object(250.0, 250.0))
Or you could declare variables as Double first then pass those.
 
Top