[英]What is the difference between adding a KeyListener to JCombobox editor and JCombobox itself
listItemsCombo.getEditor().getEditorComponent().addKeyListener(new keyPressListener()); //Works correct
這很好用。 但是,在將keyListener添加到jcomboBox時,按下“Enter”時keyPress沒有得到重新識別。 將keyListener添加到jComboxBox並將監聽器添加到其編輯器之間的確切區別是什么?何時將監聽器添加到編輯器?
listItemsCombo.addKeyListener(new KeyPressListener())//When should we use this?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.