title: Why simulating Control_A with Robot in Java is not working?
body: <p>I use the following lines to simulate a Control_A [ select all ] key action in Java with robot, but the clipboard is not getting the text, why ?</p>
  
  <pre><code>        Robot robot=null;
          try { robot=new Robot(); }
          catch (AWTException ex) { System.err.println("Can't start Robot: " + ex); }
          robot.mouseMove(260,500);
          robot.mousePress(InputEvent.BUTTON1_MASK);
  //        robot.mouseMove(660,700);
          robot.mouseRelease(InputEvent.BUTTON1_MASK);
  
          robot.keyPress(KeyEvent.VK_CONTROL);              // Select all
          robot.keyPress(KeyEvent.VK_A);
          robot.keyRelease(KeyEvent.VK_A);
          robot.keyRelease(KeyEvent.VK_CONTROL);
  
          robot.keyPress(KeyEvent.VK_CONTROL);              // Copy
          robot.keyPress(KeyEvent.VK_C);
          robot.keyRelease(KeyEvent.VK_C);
          robot.keyRelease(KeyEvent.VK_CONTROL);
  
          Transferable t=Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
          try
          {
            if (t!=null &amp;&amp; t.isDataFlavorSupported(DataFlavor.stringFlavor))
            {
              String text=(String)t.getTransferData(DataFlavor.stringFlavor);
              System.out.println(text);
            }
          }
          catch (Exception ex) { ex.printStackTrace(); }
  </code></pre>
  
  <p>I have a browser open so at [260,500] on screen there is text at that area. What have I missed ?</p>
  
  <p>Edit:</p>
  
  <p>I just found something strange, when I opened a browser, the text in the browser is not copies, but if I open a notepad/wordpad, the text in them will be copies, so why the browser didn't do it ?</p>