1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| public static void main(String[] args) throws AWTException { Random random = new Random(); String[] a = {"你干嘛~哎呦","不许欺负我家gege","食不食油饼","小黑子","树枝六六六"};
for (int i = 0; i <= 1000; i++) { String str =a[random.nextInt(a.length)]; Robot robot = new Robot(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); StringSelection selection = new StringSelection(str); clipboard.setContents(selection, null); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyRelease(KeyEvent.VK_V); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); robot.delay(500); } }
|