title: How can I Listen for Keyboard input without Text Field Java
body: <p>I am working on a Java application and interfacing with an RFID reader that acts as a keyboard input device.</p>
  
  <p>The application will be used for employee time tracking, so the employee should not see the code that his/her RFID tag contains.</p>
  
  <p>Currently, the application opens a jFrame that asks the employee to scan their tag. This is where I would like to listen for the keyboard input. </p>
  
  <p>All of the RFID tags are 10 digits, so I would like to use some kind of regex to detect when a card is scanned if possible.</p>
  
  <p>If someone could point me in the right direction, or contribute some code I would be grateful.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I was able to read the input of the scanner by adding the following to the constructor of my JFrame.</p>
  
  <pre><code>addKeyListener(new KeyListener(){
      @Override
      public void keyPressed(KeyEvent e){ System.out.print(e.getKeyChar());}
      @Override
      public void keyReleased(KeyEvent e) { }
      @Override
      public void keyTyped(KeyEvent e) { }
  });
  </code></pre>
  
  <p>So it is now confirmed that the Reader is just standard Keyboard input.</p>
  
  <p>Here is an example of what I get for a tag: 0006459027</p>
  
  <p>Now, the big question is, how do I take the characters that I got, and detect that it is a 10 digit string, and from there trigger an event to open a new frame?</p>