我试图把“a”和“zzzzzz”之间的每一序列信函输出到 mo曲线。 我急于这样做,以便顺利地与 in一道工作,但 Java却不易转换到Sting或果园。
import java.awt.AWTException;
import java.awt.event.InputEvent;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.util.concurrent.TimeUnit;
public class robot {
static int i;
public static void main(String[] args) throws AWTException, InterruptedException{
// TODO Auto-generated method stub
Thread.sleep(500);
for (int i=0; i< 30; i+=1) {
String str = " " + i + " ";
Robot r = new Robot();
Thread.sleep(200);
String text = str;
StringSelection stringSelection = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, stringSelection);
Thread.sleep(200);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_C);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_V);
}
}
}
容易转换
for (int i=0; i< 30; i+=1) {
String str = " " + i + " ";
而是与强硬顺序合作? 我曾尝试过一段时间,没有任何工作。 甚至 = = 吨t允许其汇编。