aspose file tools*
The moose likes Applets and the fly likes Applet Communication Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet Communication Problem" Watch "Applet Communication Problem" New topic
Author

Applet Communication Problem

Jon Kidd
Greenhorn

Joined: Oct 11, 2002
Posts: 29
Got a real weird applet communication problem that has been bugging me now for the last 4 hours
I have 2 applets on a jsp web page. They are called via the usual <applet> calls and incorporate the "name" tag
One of my applets needs to call a method on the other one and I have tried everything but all I get when trying to compile it is "cannot resolve symbol" whenever I try to make a reference to the other object.
ie just something simple like:

produces 'cannot resolve symbol'.
Any ideas where I am going wrong ? I thought this was supposed to be so simple
Thanks
Jon
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
Whatever message is there its right. You are taking the instance of another applet thru applet context and storing its reference in Applet class, which is a super class of all the applets.
But when you call the method of your another applet(subclass), thru the reference of Applet(superclass), it will generate compilation error, because Applet class does have any idea what exactly is there in all its sub classes.
So to get rid of this problem, you need to cast the ref. in your applet ref.
ChatApplet chatApplet = (ChatApplet)getAppletContext().getApplet("ChatApplet");
chatApplet.chatStarted();
Try this line of code :-)
I hope this can help you
Regards,
Sanjeev Kaushik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet Communication Problem