啪啪拉拉噼里啪啦

          初學者天堂資料匯集

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            16 隨筆 :: 73 文章 :: 16 評論 :: 0 Trackbacks

          import java.awt.*;
          import java.applet.*;
          import java.awt.event.*;

          public class  myjava3
          {
           public static void main(String [] agrs)
           {
                new  myjava3_1( ) ;

           }
          }
          class myjava3_1 extends Frame implements ActionListener
          {
           Label p1;
           TextField p2,p3;
           Button btn;
           myjava3_1()
           {
            super("李世春的圖像界面");
             p1=new Label("請輸入你的名字,謝謝:");
             p2=new TextField(20);
             p3=new TextField(35);
             btn=new Button("關閉本窗口");
             setLayout(new FlowLayout());
             add(p1);
                   add(p2);
             add(p3);
             add(btn);
             p2.addActionListener(this);
             btn.addActionListener(this);
             setSize(300,200);
             show();
           
           };
           public void actionPerformed(ActionEvent e)
           {
           
            if(e.getSource()==p2)
            { p3.setText(p2.getText()+",welcome !");}
            else
            { 
             dispose();
             System.exit(1);
            }
           }
          }

          繼承了 Frame  類
          public class myjava03 extends Frame implements ActionListener
          setLayout( new FlowLayout() );
          input.actionListener(this)
          btn.actionListener(this)

           public void actionPerformed(ActionEvent e)
           {
           
            if(e.getSource()==p2)
            { p3.setText(p2.getText()+",welcome !");}
            else
            { 
             dispose();
             System.exit(1);
            }
           }
          }

          actionPerformed(ActionEvent e)

          e.getSource== input  判斷是否是input 輸入。

          posted on 2005-04-17 07:07 噼里啪啦的世界 閱讀(361) 評論(1)  編輯  收藏 所屬分類: java

          評論

          # re: java applection 圖形界面應用 2005-04-20 14:52 小力力力
          "java applection 圖形界面應用"

          字寫錯了吧?要有點專業精神嘛~~~~  回復  更多評論
            


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


          網站導航:
           
          主站蜘蛛池模板: 称多县| 噶尔县| 宜黄县| 永新县| 永登县| 澳门| 宁海县| 和静县| 淳化县| 旅游| 巫山县| 龙川县| 平舆县| 怀远县| 环江| 钟祥市| 黑河市| 临湘市| 延吉市| 陇川县| 大宁县| 济宁市| 西乡县| 庆城县| 嘉兴市| 兴仁县| 太白县| 新绛县| 满城县| 安仁县| 公安县| 应城市| 修武县| 开封市| 珲春市| 化德县| 咸阳市| 淅川县| 甘孜| 普格县| 扎鲁特旗|