StarLover
          To find the lost memorise...

          希望實現一個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中的組件了。

          2005年12月18日

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

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


          網站導航:
           
           
          主站蜘蛛池模板: 吉木乃县| 高密市| 万安县| 玉山县| 扶余县| 锡林浩特市| 铁力市| 财经| 建湖县| 峨边| 五台县| 虹口区| 皮山县| 双鸭山市| 富锦市| 凌源市| 华安县| 阿巴嘎旗| 江安县| 洱源县| 舞钢市| 呼玛县| 潞城市| 鲁甸县| 榕江县| 阳信县| 南平市| 磴口县| 东光县| 德保县| 泊头市| 荔浦县| 和顺县| 当雄县| 宁武县| 金湖县| 安龙县| 屯门区| 赣榆县| 建宁县| 宁陵县|