• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applet Communication Problem

 
Greenhorn
Posts: 29
  • 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
 
Ranch Hand
Posts: 105
  • 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
 
I don't even know how to spell CIA. But this tiny ad does:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic