• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet Communication Problem

 
Jon Kidd
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 105
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic