啪啪拉拉噼里啪啦

          初學者天堂資料匯集

            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 噼里啪啦的世界 閱讀(365) 評論(1)  編輯  收藏 所屬分類: java

          評論

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

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


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


          網站導航:
           
          主站蜘蛛池模板: 津市市| 普兰店市| 眉山市| 山阴县| 萍乡市| 宁国市| 黎平县| 昌乐县| 阳新县| 滦平县| 襄汾县| 万载县| 桂东县| 平阴县| 凤阳县| 宁海县| 河曲县| 陵川县| 政和县| 内黄县| 故城县| 广元市| 常熟市| 合江县| 调兵山市| 布拖县| 瑞安市| 西充县| 阳高县| 万盛区| 大同市| 阳江市| 尼勒克县| 衡南县| 保德县| 尖扎县| 徐水县| 马边| 广宗县| 古交市| 沙田区|