Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JCombo Problem

  Asked By: Jason    Date: Dec 16    Category: Java    Views: 461

I try to make JCombo able to listen to KeyAction event, seem like
it's not so simple as for JTextField although it should work as the

Anyone here can advice why no KeyAction is fired although I type
things on the editable combo box



2 Answers Found

Answer #1    Answered By: Dale Jones     Answered On: Dec 16

this problem  is reported by several programmer
just create a textbox set it property hidden
store the value of jcombobox in textbox and then
fire the events on jcombobox

Answer #2    Answered By: Nicolas Costa     Answered On: Dec 16

I think can try this also
JComboBox combo  = new JComboBox();
JTextField textField2 = (JTextField)combo.getEditor().getEditorComponent();
textField2.addKeyListener(new KeyActionHandler());

Didn't find what you were looking for? Find more on JCombo Problem Or get search suggestion and latest updates.