File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes KeyListener of JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "KeyListener of JComboBox" Watch "KeyListener of JComboBox" New topic

KeyListener of JComboBox

Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 434
I add a KeyListener to my comboBox. But When I edit an item of my comboBox(Of course, there are key typed, pressed, released events occured), but no event invoked.
If I use the KeyListener in a wrong way why do a keylistener be added to a comboBox.
Thanks in advance.
PS:If I don't describe it clearly, please let me know.

To be or not to be. It's a question.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
in the absence of any code which demonstrates the problem, I will guess

if you are adding your keylistener like this

it should be
Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 434
Thank you
It works!
Why don't write this in the java tutorial? Or I've not read it?
I agree. Here's the link:
subject: KeyListener of JComboBox
It's not a secret anymore!