Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Combo box with a key listener- pls help

 
Sajee Joseph
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI everbody,
I need a combobox. The combo box will be intially loaded with some items. Now i need a key listener to this combo box, such that when i click ok 's', i need to display the items which begins with 's'. How do i go about this.
Regards
Saj
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Saj,
i've never done that with a combo box only with a list. if its not working with a KeyListener and a uneditable combobox then try to set the JComboBox to setEditable(true). you will have to make sure that the user can use the edit-feature only for the fast lookup.
anyway, try it first with setEditable(false). the combobox must have the focus (mouseclick inside the combo). the keylistener listens to different triggers (KEY_TYPED, KEY_PRESSED). which one is the appropriate depends on the platform and the key. i think, key_typed is the one for you.
chantal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic