Article View: borland.public.jbuilder.java.swing
Article #9208Re: jdbNavComboBox and eventhandling?
From: Paul Furbacher [TeamB]
Date: Fri, 12 May 2000 00:00
Date: Fri, 12 May 2000 00:00
30 lines
1771 bytes
1771 bytes
Forum Borland wrote:
>
> when using a swing jdbNavcombobox i want to use some events attached to the
> this component.
> the keylistener events Keypressed,keyTyped, keyReleased Dont fire when
> typing in the box.
> i have tried making my own eventhandlers (keylistener) and adding it to the
> jdbnavcombobox, since components can fire events to several eventhandlers
> but that dont work either.
>
> maybe swing overides the event somehow since its used in the functionality
> of the component or????
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:
<391C19C5.3396C61C@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8fgtpv$iot2@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e90c7079d92d94ee X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pnf@home.com> Subject: Re: jdbNavComboBox and eventhandling? Date: 2000/05/12 Message-ID: <391C19C5.3396C61C@home.com> X-Deja-AN: 622575016 Content-Transfer-Encoding: 7bit References: <8fgtpv$iot2@bornews.borland.com> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pnf@home.com Newsgroups: borland.public.jbuilder.java.swing