Article View: borland.public.jbuilder.java.swing
Article #7646Re: How to receive JComboBox's KeyListener event?
From: Torsten Welches
Date: Thu, 11 Jan 2001 12:34
Date: Thu, 11 Jan 2001 12:34
29 lines
1530 bytes
1530 bytes
Betty,
just add it directly to your JComboBox.
This works for me:
String[] values = {"aTest","bTest", "cTest"};
JComboBox combo = new JComboBox(values);
combo.setEditable(false);
combo.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
System.err.println(e);
}
});
Good luck,
Torsten
Betty <cutepang@net.polyu.edu.hk> wrote:
>Dear all,
>
>My ComboBox is not editable! So, I can't get the EditorCompoent and add
>KeyListener to it.
>How can I still receive JComboBox's KeyListener event (Not Editable
>Box)?
>
>Thanks
>Betty
>
Technical Details
Message-ID:
<3a5da838$1_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!207.105.83.65References:
<3A5D83FA.665F9A05@net.polyu.edu.hk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a8659c08c1f7aefa X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-11 04:42:05 PST From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Subject: Re: How to receive JComboBox's KeyListener event? Newsgroups: borland.public.jbuilder.java.swing X-User-Info: 193.158.55.74 193.158.55.74 References: <3A5D83FA.665F9A05@net.polyu.edu.hk> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3a5da838$1_1@dnews> Date: 11 Jan 2001 04:34:00 -0800 X-Trace: 11 Jan 2001 04:34:00 -0800, 207.105.83.65 Lines: 30 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!207.105.83.65