This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to search in a JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to search in a JComboBox" Watch "how to search in a JComboBox" New topic
Author

how to search in a JComboBox

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
I would like to know how to use the KeyListener in the JComboBox.
You should be able to start typing in an editable JComboBox and everytime a key is typed you should select the entered element or the closest one. (please include example)
Thanks,
Jelle
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have been wanting to do the same thing. Did you find a solution?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi,
I am not sure how to perform the search you are describing but I can help you with the keyListener stuff. JComboBox is the worst Swing component you can think of ...

Enjoy,
Manfred
Brian Snyder2002
Greenhorn

Joined: Jan 24, 2002
Posts: 11
Thanks Manfred!!!
This is just what I needed!


Java Developer<br />SCJ2P
kalpana s
Greenhorn

Joined: Dec 22, 2003
Posts: 8
i have used the same piece of code, but the key events are not getting triggered.
What could be the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to search in a JComboBox