title: Robot's keyPress() doesn't work as should
body: <p>I need help with <code>Robot</code> class in Java. I have the following code:</p>
  <pre><code>public static void main(String[] args) throws AWTException {
      Robot r = new Robot();
      r.delay(3000);
      r.keyPress(KeyEvent.VK_7);
      r.delay(5000);
      r.keyRelease(KeyEvent.VK_7);
  }
  </code></pre>
  <p>From what I understand, this code has to press &quot;7&quot; and release it after 5 seconds. But it presses &quot;7&quot; and then releases it immediately. So, <code>Robot</code> class doesn't press and release after a while, but it fires the key once instead.</p>
  <p>How do I make my Java application to hold a key for few seconds, then release?</p>