title: How to enter data when JFrame form is minimized in Java?
body: <p>How to get barcode details to a list when the JFrame form is minimized. I am trying to get each barcode details to a JList when the form is minimized. I am using this code to seperate barcode details from other key events. But I can't figure out how to put details to a JList when even the JFrame is minimized.</p>
  
  <p>So How can I fix it? Anyone can help me?
  Thanks for the help in advance! Best Regards.</p>
  
  <pre><code>private static final long THRESHOLD = 100;
  private static final int MIN_BARCODE_LENGTH = 8;
  private final StringBuffer barcode = new StringBuffer();
  private long lastEventTimeStamp = 0L;
  DefaultListModel dlm = new DefaultListModel();
  
  KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher()
          {
              @Override
              public boolean dispatchKeyEvent(KeyEvent e)
              {
                  if (e.getID() != KeyEvent.KEY_RELEASED)
                  {
                      return false;
                  }
  
                  if (e.getWhen() - lastEventTimeStamp &gt; THRESHOLD)
                  {
                      barcode.delete(0, barcode.length());
                  }
  
                  lastEventTimeStamp = e.getWhen();
  
                  if (e.getKeyCode() == KeyEvent.VK_ENTER)
                  {
                      if (barcode.length() &gt;= MIN_BARCODE_LENGTH)
                      {
                          jList1.setModel(dlm);
                          dlm.addElement(barcode.toString().trim());
                      }
                      barcode.delete(0, barcode.length());
                  } else {
                      barcode.append(e.getKeyChar());
                  }
                  return false;
              }
          });
  </code></pre>