首页 青云排行榜 知识中心 控制台

在一个HTML页面中,两个或多个Applet可以通过什么方法相互通信?(     )

多个小程序不能在一个HTML页面内相互通信

getCodeBase()

getDefaultContext()

getAppletContext()

希望实现一个Applet与另外一个Applet进行通讯时,必须用getAppletContext()方法先取得另外一个Applet的句柄,再用getAplplet(name)方法取得Applet,具体代码实例如下:
AppletContext ac = getAppletContext();
Applet applet = ac.getContext(“other”);
TextArea text = (TextArea)applet.getComponent(2);
Text.append(“good luck”+”\n”);
其中other是另外一个Applet的名字:
<html>
       <applet code = “applet.java” width=”300” height=”200” name=”other”></applet>
</html>

而getComponent(2)中的参数“2”是指添加到Applet中的组件的次序(从1开始);
这样我们就能操纵另外一个Applet中的组件了。
关于我们
公司简介
联系我们
联系我们
售前咨询: leizhongnan@eval100.com
售后服务: 0755-26415932
商务合作: support@eval100.com
友情链接
金蝶软件
快递100
关注我们
Copyright © 2023-2023 深圳慧题科技有限公司 粤ICP备2023109746号-1 粤公网安备44030002001082