How to make the Java.awt.Robot type unicode characters? (Is it possible?)

前端 未结 4 762
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 10:09

We have a user provided string that may contain unicode characters, and we want the robot to type that string.

How do you convert a string into keyCodes that the rob

4条回答
  •  眼角桃花
    2020-11-29 10:59

    i think this is a bit late but...

    Robot robot = new Robot();
    
       robot.keyPress( KeyEvent.VK_DEAD_ACUTE);
    
       robot.keyPress( KeyEvent.VK_A );
       robot.keyRelease( KeyEvent.VK_A );
    
       robot.keyRelease( KeyEvent.VK_DEAD_ACUTE );
    

    that just type an "á"

提交回复
热议问题