Article View: borland.public.jbuilder.java.language
Article #17665Re: Events and listoners
From: Dillan Fernando
Date: Fri, 16 Oct 1998 00:00
Date: Fri, 16 Oct 1998 00:00
43 lines
1902 bytes
1902 bytes
Hi Richard
I had a similar requirement, I wanted to have an action listner, but I was
unable to implement an action listner.
Instead wha I did was used Java Reflection to invoke a method the main
applet.
Here is the code, perhaps this will help you.
Class c = appletObject.getClass(); // you have to pass a ref. to the
applet into the thread. (appletObject)
Class classTempArray[] = {};
Object objTempArray[] = {};
try{
Method m = c.getMethod("AppletMethod",classTempArray);
m.invoke(appletObject,objTempArray);
}
catch(Exception e){e.printStackTrace();}
I'm not sure whether this fulfils you requirement. If you come accross a
better method of doing this, Please email me.
Regards
Dillan Fernando
Senior Analyst
Palmware (pvt) Ltd
Sri Lanka
Richard Hawkes wrote in message <36262FC7.1511C37A@nbtel.nb.ca>...
>Hi, I am writing a applet with JBuilder 2. My program runs a thread
>that keeps checking a screen for a field of text to appear. When this
>happens I want to trigger and event back in the main program.
> I figured I could use the same functionality that a button event
>uses. I would throw some kind of event from the Thread, and then the
>Main program would have a listener that would be activated, and then it
>would run some code.
> If some one could point me in the right direction it would be
>appreciated.
>
>Thanks
>
Technical Details
Message-ID:
<705k6m$p0h2@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36262FC7.1511C37A@nbtel.nb.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,97fd6f0b3e17a57e X-Google-Attributes: gidf74b3,public From: "Dillan Fernando" <dillan@geocities.com> Subject: Re: Events and listoners Date: 1998/10/16 Message-ID: <705k6m$p0h2@forums.borland.com> X-Deja-AN: 401461045 References: <36262FC7.1511C37A@nbtel.nb.ca> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Palmware Newsgroups: borland.public.jbuilder.java.language