Thursday, February 12, 2009

How would you detect a keypress in a JComboBox

Question :How would you detect a keypress in a JComboBox?
Answer :This is a trick. most people would say ‘add a KeyListener to the JComboBox’ - but the right answer is ‘add a KeyListener to the JComboBox’s editor component.’

No comments: