• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Applet Communication Problem

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic