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

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


          網站導航:
           
           
          主站蜘蛛池模板: 大理市| 竹山县| 都昌县| 贡觉县| 伊通| 安泽县| 马关县| 海城市| 盐源县| 迁西县| 北碚区| 安顺市| 手游| 含山县| 清流县| 德兴市| 武陟县| 邓州市| 抚顺市| 城步| 惠水县| 镇平县| 盐山县| 丰宁| 进贤县| 清原| 年辖:市辖区| 凤庆县| 绥化市| 固原市| 横峰县| 尼勒克县| 资源县| 西贡区| 七台河市| 邹城市| 山阳县| 苗栗市| 鸡泽县| 海宁市| 通榆县|