Javafx机器人无法从Javafx 2.2工作

Javafx机器人无法从Javafx 2.2工作,java,automation,javafx,javafx-2,Java,Automation,Javafx,Javafx 2,看起来com.sun.glass.ui.Robot在JavaFX2.2中不再工作 还有其他选择吗 我已经转向AWT机器人,但这似乎不是最好的解决方案。玻璃(FX)机器人在2.2中为我工作。请尝试下一步: public void start(Stage stage) { Button btn = new Button(); btn.setText("Button"); btn.setOnAction(new EventHandler<ActionEvent>()

看起来com.sun.glass.ui.Robot在JavaFX2.2中不再工作

还有其他选择吗

我已经转向AWT机器人,但这似乎不是最好的解决方案。

玻璃(FX)机器人在2.2中为我工作。请尝试下一步:

public void start(Stage stage) {
    Button btn = new Button();
    btn.setText("Button");
    btn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            System.out.println("Hello World!");
        }
    });

    Scene scene = new Scene(new Group(btn), 300, 250);

    stage.setTitle(VersionInfo.getRuntimeVersion());
    stage.setScene(scene);
    stage.setX(100);
    stage.setY(100);
    stage.show();

    Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
    robot.mouseMove(130, 130);
    robot.mousePress(1);
    robot.mouseRelease(1);
}
公共作废开始(阶段){
按钮btn=新按钮();
btn.setText(“按钮”);
btn.setOnAction(新的EventHandler