StarLover
          To find the lost memorise...

          希望實(shí)現(xiàn)一個Applet與另外一個Applet進(jìn)行通訊時,必須用getAppletContext()方法先取得另外一個Applet的句柄,再用getAplplet(name)方法取得Applet,具體代碼實(shí)例如下:

          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)中的參數(shù)“2”是指添加到Applet中的組件的次序(從1開始);

          這樣我們就能操縱另外一個Applet中的組件了。

          2005年12月18日

          posted on 2005-12-18 12:44 StarLover 閱讀(611) 評論(1)  編輯  收藏
          Comments
          • # re: Applet之間的通訊[未登錄]
            liu
            Posted @ 2008-03-04 23:11
            applet.getComponent(2);
            還是不明白2 是為什么??  回復(fù)  更多評論   

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
           
          主站蜘蛛池模板: 古田县| 南京市| 分宜县| 赣榆县| 新宁县| 平阳县| 游戏| 扶沟县| 内乡县| 长海县| 新宁县| 深圳市| 元氏县| 洪泽县| 江山市| 灵璧县| 镇康县| 绥德县| 娄烦县| 扎鲁特旗| 金阳县| 咸阳市| 镇坪县| 天等县| 稻城县| 常山县| 汽车| 汉川市| 类乌齐县| 平乡县| 九龙城区| 金昌市| 甘南县| 兰州市| 鄂伦春自治旗| 广饶县| 达孜县| 抚顺市| 泗水县| 黄平县| 察哈|