|
-
February 22nd, 2000, 11:25 AM
#1
JComboBox keyListener
I want to make a JComboBox editable. Easy enough. Now I want to add a keyListener so I can validate the user's input as he/she keys in text.
However, the keyTyped event never gets called.
I'm using the VCE in VA/Java 3.0 with JDK1.2.2. I set up the keyTyped event in the VCE. But the method never gets called.
Any suggestions as to why this doesn't get called? Or how I can trap the keyTyped event?
thanks,
-
February 22nd, 2000, 01:52 PM
#2
Re: JComboBox keyListener
Get editor component and add KeyListener to it.
-
March 1st, 2000, 02:15 PM
#3
Re: JComboBox keyListener
PLease could you (or someone) explain this in better detail...
"editor" component?
Thanks + this is a good question..
-
March 1st, 2000, 05:49 PM
#4
Re: JComboBox keyListener
Hi ,
JComboBox has an "Editor"( not a component , javax.swing.plaf.basic.BasicComboBoxEditor )
which is a wrapper around the actual Editor "Component" ( which is JTextField ). To get this
JTextField , first you have to get the "Editor" and then get the actual "Component".
JTextField editorcomp = comboBox.getEditor().getEditorComponent();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|