| 1. |
How Will You Communicate Between Two Applets? |
|
Answer» The simplest method is to use the STATIC variables of a SHARED class since there's only one instance of the class and hence only one copy of its static variables. A slightly more RELIABLE method relies on the fact that all the APPLETS on a given page share the same AppletContext. We obtain this applet context as follows: AppletContext ac = getAppletContext(); AppletContext provides applets with methods such as getApplet(name), getApplets(),getAudioClip, getImage, showDocument and showStatus(). The simplest method is to use the static variables of a shared class since there's only one instance of the class and hence only one copy of its static variables. A slightly more reliable method relies on the fact that all the applets on a given page share the same AppletContext. We obtain this applet context as follows: AppletContext ac = getAppletContext(); AppletContext provides applets with methods such as getApplet(name), getApplets(),getAudioClip, getImage, showDocument and showStatus(). |
|