• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to attach KeyListener with JComboBox?

 
n Afsheen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to attach KeyListener with JComboBox, when it is setEditable? and can we set Editor other than its defaut editor
 
Shishir Parikh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, technically it is possible to use a KeyListener with an editable JComboBox.
But an editable JComboBox is a composite component, i.e., it is made up of more than 1 basic components (which components, depends on the look & feel). If one tries to use low level listeners with it, then one might have to change the Look & Feel code for it depending on the systems on which it is going being used, which is not a very desirable prospect.
Hence, it is advisable to use only higher level events like ItemEvent and ActionEvent with an editable JComboBox.
Njoy,
SHISH.
Originally posted by n Afsheen:
Is it possible to attach KeyListener with JComboBox, when it is setEditable? and can we set Editor other than its defaut editor

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic