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 閱讀(611) 評論(1)  編輯  收藏
          Comments
          • # re: Applet之間的通訊[未登錄]
            liu
            Posted @ 2008-03-04 23:11
            applet.getComponent(2);
            還是不明白2 是為什么??  回復  更多評論   

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


          網站導航:
           
           
          主站蜘蛛池模板: 中牟县| 五峰| 弥渡县| 白朗县| 富宁县| 呼伦贝尔市| 望都县| 普安县| 荥经县| 五原县| 施秉县| 任丘市| 南召县| 枞阳县| 汶川县| 晋宁县| 顺平县| 湘潭市| 德钦县| 葵青区| 客服| 洛南县| 缙云县| 台安县| 乡宁县| 棋牌| 屏东市| 油尖旺区| 简阳市| 治县。| 樟树市| 磐安县| 东乌| 信丰县| 新营市| 乐陵市| 花莲市| 唐河县| 洛川县| 文安县| 开封市|