Robot class java , typing a string issue
问题 I m using the following loop , but its only typing the first charecter and the rest as numbers, any idea ? import java.awt.*; import javax.swing.KeyStroke; public class test { public static void main(String[] args) throws AWTException { Robot r = new Robot(); String s = "Face"; for (int i = 0; i < s.length(); i++) { char res = s.charAt(i); r.keyPress(res); r.keyRelease(res); r.delay(1000); } } } OUTPUT typing : F135 回答1: The keyPress/Release methods need an int value that represents the