Article View: borland.public.jbuilder.java.swing
Article #9099Re: Typing in JComboBox doesn't cause the keyTyped event to be fired
From: Christer Brattlund
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
20 lines
1359 bytes
1359 bytes
Ok, I found the answer in a message posted here earlier:
-----------
My guess is that since JComboBox, from which JdbNavComboBox extends (via
another class or two), is a compound component, consisting of an editor
and a list (did I forget something else?), you have to reach into
this compound component and add listeners to the desired component.
In this case, it would be the editor. So, you'd write something like
the following (I might be a little off since I don't have a Swing
reference in front of me):
// given a JdbComboBox cb
JTextField tf = (JTextField)cb.getEditor().getEditorComponent();
tf.addMouseListener(new java.awt.event.MouseAdapter() {...});
tf.addKeyListener(...);
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<8gg5un$cs74@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8gg2u8$csb4@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,d1eaa09f97497005 X-Google-Attributes: gid111d45,public From: "Christer Brattlund" <christer.brattlund@REMOVE_THIS.aerotechtelub.se> Subject: Re: Typing in JComboBox doesn't cause the keyTyped event to be fired Date: 2000/05/24 Message-ID: <8gg5un$cs74@bornews.borland.com> X-Deja-AN: 626643754 References: <8gg2u8$csb4@bornews.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing