title: locking JTextField from external updates while editing
body: <p>My GUI displays the data coming from the backend every 500ms. I'm having a race condition when it comes to editing fields. By the time the Action listener is invoked, the value from the backend overwrites whatever the user entered manually into a text field.</p>
  
  <p>Is there a way to lock the field or use a semaphore or retrieve new value from elsewhere?</p>
  
  <p>Thanks.</p>
  
  <pre><code>        JTextField tf = new JTextField();
          tf.setName("reg_r"+i);          
          tf.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  // TODO Auto-generated method stub
                  JTextField tf = (JTextField)e.getSource();
  
                  //prints OLD value!
                  System.err.println(tf.getText());
  
              }
          });
  </code></pre>