Article View: borland.public.jbuilder.java.swing
Article #8107What is the purpose of dispatchEvent
From: Jon Scoleri
Date: Wed, 25 Oct 2000 00:00
Date: Wed, 25 Oct 2000 00:00
25 lines
1675 bytes
1675 bytes
Does dispatchEvent allow me to throw an event on the object's queue to be processed after the current chain of events completes? I am creating a spelling program. As each character is typed into a JTextField, I am giving an audible signal as to whether the letter matches the next letter in the word. I am doing this in the keyTyped event handler. From the keyTyped event handler I want to tell another event to do the check on the complete word to see if it is spelled correctly. Within the keyTyped event handler jTextField1.getText() does not include the character that was just typed. I can get the complete value by doing the following jTextField1.getText() + e.getKeyChar(). Is there an event that I can add a handler for where jTextField1.getText() will return the complete value including the character just type or can I use dispatchEvent to cause another event to be fired? I have tried dispatching an ACTION_EVENT in the keyTyped event handler in the following manner: jTextField1.dispatchEvent( new ActionEvent( this, Event.ACTION_EVENT, "" ) ); I added an event handler for this but it was never executed. Any help would be appreciated.
Technical Details
Message-ID:
<39f736f7_1@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,7ffeb751053a24a8,start X-Google-Attributes: gid111d45,public From: "Jon Scoleri" <jscoleri@webpipe.net> Subject: What is the purpose of dispatchEvent Date: 2000/10/25 Message-ID: <39f736f7_1@dnews> X-Deja-AN: 685802220 X-Trace: 25 Oct 2000 12:39:35 -0800, 208.11.90.2 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.swing X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400