Here is my
test case for this problem. The instanceof test and ClassCast fails but the getClass() shows the same named class?
To get the programs to work I overrode an existing method (getForeground() in the applet to demonstrate that the applets can communicate.
How do you get them to work via casting?
I put the "Master" class definition in the Bullet jar. The Bullet class needs the definition to be able to do the cast.
******* The HTML for testing the above applets *******************************
<HTML><HEAD><TITLE>Test inter applet commuication</TITLE></HEAD>
<BODY>
<applet name="Master" code=Testing.AppletCommMain archive=AppletCommMain.jar width=200 height=100>
</applet>
<applet name="Bullet1" code=Testing.AppletCommBullet archive=AppletCommBullet.jar width=50 height=50>
</applet>
<applet name="Bullet2" code=Testing.AppletCommBullet archive=AppletCommBullet.jar width=50 height=50>
</applet>
</BODY>
</HTML>
************ The batch file that creates the jar files: **********************
@REM Make jar files for testing Applet Communications
cd ..
jar -cf Testing\AppletCommMain.jar Testing\AppletCommMain.class
jar -cf Testing\AppletCommBullet.jar Testing\AppletCommBullet.class Testing\AppletCommMain.class