M magarcan Active Member Licensed User Longtime User Dec 11, 2019 #1 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
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
Cableguy Expert Licensed User Longtime User Dec 11, 2019 #2 My best guess is your event declaration is wrong.... You could use this instead... Much simpler. https://www.b4x.com/android/forum/t...-keyboard-and-mouse-events-etc.55832/#content Upvote 0
My best guess is your event declaration is wrong.... You could use this instead... Much simpler. https://www.b4x.com/android/forum/t...-keyboard-and-mouse-events-etc.55832/#content
stevel05 Expert Licensed User Longtime User Dec 11, 2019 #3 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. Upvote 0
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.
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2019 #4 Best way is to create a sub for this: B4X: Sub MoveMouse(x as double, y as double) Dim robot As JavaObject robot.InitializeNewInstance("javafx.scene.robot.Robot", Null) robot.RunMethod("mouseMove", Array (x, y)) End Sub Upvote 0
Best way is to create a sub for this: B4X: Sub MoveMouse(x as double, y as double) Dim robot As JavaObject robot.InitializeNewInstance("javafx.scene.robot.Robot", Null) robot.RunMethod("mouseMove", Array (x, y)) End Sub