Click to See Complete Forum and Search --> : KeyListener for a JComboBox


Totte_ch
07-09-2009, 01:05 PM
Hi

I wanted to add a keylistener to my JComboBox.
I know that this doesn't work:
jcombobox.addKeyListener(...);
An I know this should work:
jcombobox.getEditor().getEditorComponent().addKeyListener(...);

But it doesn't work, when I set the UI theme like this (I use Windows XP, and that's the theme I get):
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(jcombobox);
}catch(Exception e){}

Why? Is there any work around for this?


Thanks for help!