title: How can I know when the text of an editable JComboBox has been changed?
body: <p>I have an <em>editable</em> JComboBox where I want to take some action whenever the text is changed, either by typing or selection.  In this case, the text is a pattern and I want to verify that the pattern is valid and show the matches that result in some test data.</p>
  
  <p>Having done the obvious, attach an ActionHandler, I have found that, for typing, the event seems to fire unreliably, at best (selection is fine).  And when it <em>does</em> fire as a result of typing, the text retrieved (using getEditor().getItem(), since getSelectedItem() only gets the text when it was selected from the list) seems to be the text as it was when the last event was fired - that is, it's always missing the character was typed immediately before the action event was fired.</p>
  
  <p>I was expecting the action event to fire after some short delay (500ms to 1 second), but it seems immediately fired upon keying (if it is fired at all).</p>
  
  <p>The only workable alternative I can think of is to simply start a 1 second timer on focus-gained, killing it on focus-lost and doing the work as the timer action if the content is different from last time.</p>
  
  <p>Any thoughts or suggestions?</p>
  
  <p>The code snippets are not particularly interesting:</p>
  
  <pre><code>find.addActionListener(this);
  ...
  public void actionPerformed(ActionEvent evt) {
      System.out.println("Find: "+find.getEditor().getItem());
      }
  </code></pre>