code: public void keyReleased(KeyEvent e) {
          char ch = e.getKeyChar();
          if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch))
              return;
          int pos = editor.getCaretPosition();
          String str = editor.getText();
          if (str.length() == 0)
              return;
  
          boolean matchFound = false;
          for (int k = 0; k < comboBox.getItemCount(); k++) {
              String item = comboBox.getItemAt(k).toString();
              if (startsWithIgnoreCase(item, str)) {
                  comboBox.setSelectedIndex(k);
                  editor.setText(item);
                  editor.setCaretPosition(item.length());
                  editor.moveCaretPosition(pos);
  
                  // show popup when the user types
                  if (comboBox.isDisplayable())
                      comboBox.setPopupVisible(true);
  
                  matchFound = true;
                  break;
              }
          }
          if (!matchFound) {
              // hide popup when there is no match
              comboBox.setPopupVisible(false);
          }
      }
docs: Handle a key release event. See if what they've type so far matches anything in the
  selectable items list. If so, then show the popup and select the item. If not, then
  hide the popup.
  
  @param e key event