listItemsCombo.getEditor().getEditorComponent().addKeyListener(new keyPressListener()); //Works correct
这工作正常。但是,在将keyListener添加到jcomboBox时,按下“Enter”键时keyPress不会被识别。将keyListener添加到jComboxBox并向其编辑器中添加侦听器之间的区别是什么?何时将侦听器添加到编辑器中?是添加KeyListener到JCombobox编辑器和JCombobox本身之间有什么区别
listItemsCombo.addKeyListener(new KeyPressListener())//When should we use this?
[Java Editable JCombobox Keylistener event for Enter key]可能的重复(http://stackoverflow.com/questions/14056301/java-editable-jcombobox-keylistener-event-for-enter-key) – 2015-03-02 11:49:57
它可以很好地工作我使用编辑器的监听器,但我的问题是何时使用它?我们是否使用它? – divya 2015-03-02 11:55:38