ADDITIONAL SYSTEM INFORMATION : Linux / Fedora 37 (x64) Tested with Java 23.0.1 and JavaFX 23.0.1 / 24-ea+19 A DESCRIPTION OF THE PROBLEM : Current javadoc says: /** * Moves mouse pointer to given screen coordinates. * @param x X position * @param y Y position */ public synchronized void mouseMove(int x, int y) { However, Robot.mouseMove() does not move the mouse cursor visually, but the following Robot.mousePress() is delivered to the correct place. This is the same bug as JDK-8280995 but this bug report is for AWT. It works as expected with: - JavaFX robot with Java 23.0.1 and JavaFX 23.0.1 on Windows 10. It doesn't work as expected with: - JavaFX robot with Java 23.0.1 and JavaFX 23.0.1 on Fedora 37. - JavaFX robot with Java 23.0.1 and JavaFX 24-ea+19 on Fedora 37. - AWT robot with Java 23.0.1 and JavaFX 24-ea+19 on Fedora 37 (I get the same buggy behaviour with both AWT and JavaFX robots). STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1/ Compile the attached code. 2/ Launch the resulting jar. 3/ Click on the button named "test robot" with your mouse. 4/ Type on the key Space to close the dialogbox that has just popped up. 5/ Click again on the left button of the mouse. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - After step 3/, the mouse pointer should have moved above the button named "display hello". ACTUAL - After step 3/, the mouse pointer is still above the button named "test robot". But when clicking on the mouse at step 5/ without moving the mouse, the click gets registered on the button named "display hello", which is quite confusing. ---------- BEGIN SOURCE ---------- package com.mycompany.mavenproject3; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.input.MouseButton; import javafx.scene.layout.FlowPane; import javafx.scene.robot.Robot; import javafx.stage.Stage; /** * JavaFX App */ public class App extends Application { @Override public void start(Stage stage) { var button = new Button("test robot"); var button2 = new Button("display hello"); var scene = new Scene(new FlowPane(button, button2), 640, 480); stage.setScene(scene); stage.show(); button.setOnAction(e -> { Robot robot = new Robot(); robot.mouseMove(button2.localToScreen(1, 1)); robot.mouseClick(MouseButton.PRIMARY); }); button2.setOnAction(e -> { Dialog<String> dialog = new Dialog(); dialog.setContentText("hello"); dialog.getDialogPane().getButtonTypes().add(ButtonType.OK); dialog.show(); }); } public static void main(String[] args) { launch(); } } ---------- END SOURCE ---------- FREQUENCY : always
|