public static void installListeners(JComboBox myCombo, final ComboEditorListener listener) {
    myCombo.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent event) {
        listener.onValueChosen();
      }
    });

    myCombo.registerKeyboardAction(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent event) {
        listener.onCancelled();
      }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  }
public static void installListeners(JComboBox myCombo, final ComboEditorListener listener)