Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mw.google.doodle;
- import java.awt.AWTException;
- import java.awt.Robot;
- import java.awt.event.KeyEvent;
- public class BasketBall2012 {
- public static void main(String args[]) throws AWTException {
- int duration = 0;
- Robot r = new Robot();
- r.delay(5000);
- long startTime = System.currentTimeMillis();
- while (duration < 25) {
- r.keyPress(KeyEvent.VK_SPACE);
- if ((duration = (int) (System.currentTimeMillis() - startTime) / 1000) <= 5) {
- r.delay(400);
- } else if (duration > 5 && duration < 10) {
- r.delay(500);
- } else if (duration >= 10 && duration < 17) {
- r.delay(750);
- } else if (duration >= 17) {
- r.delay(850);
- }
- r.keyRelease(KeyEvent.VK_SPACE);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement