title: How to get Keybord input to console using `Robot` class?
body: <p>I am trying to implement virtual keyboard using swing. I have made my own design , now If I press on <code>button A</code> it should print <code>A</code> on console. How to do this.? As of now I have done this much...</p>
  
  <pre><code>private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  
      //System.out.println(" "+evt.getSource());
      if(evt.getSource()==jButton8)
      {
          try{
              Robot robot = new Robot(); 
              robot.keyPress(KeyEvent.VK_A); 
              }
              catch(Exception E){}
      }
  }  
  </code></pre>
  
  <p>Can any one help me in this, and I am doing this in <code>NetBeans IDE</code>.</p>