语源科技BlogJava 联系 聚合 管理  

Blog Stats

News

 

蓝冰飞寒个人独立博客地址,www.uphenan.com

随笔档案

文章档案


蓝冰飞寒

用心去做每一件事情

今早上起的很早啊,呵呵,学习了,还不错。。不知道为什么啊就是到了四点就睡不着了,所以就起来了,应该是昨晚上睡的太早了。我自己加上的窗口关闭的小应用,得记下来,今天一定能够熟练的掌握这个东西。


import java.awt.*;
import java.awt.event.*;
public class TFFrame extends Frame{
  
      TFFrame(){
        TextField tf = new TextField();
        add(tf);
        Monitor3 bh= new Monitor3();
        add(tf);
        tf.addActionListener(bh);
        pack();
        setVisible(true);
        addWindowListener(new WindowAdapter(){
                               public void windowClosing(WindowEvent e){
                               System.out.println("Atention");
                               System.out.println("Program is Closed.");
                             System.exit(0);
                             }
                               });
        
        }
        public static void main(String args[]){
          
          new TFFrame();
          
          }
   }
  
  
   class  Monitor3 implements ActionListener{
        public void actionPerformed(ActionEvent e){
              TextField tf = (TextField)(e.getSource());
              System.out.println(tf.getText());
              tf.setText("");
          
          }
    
     }
Tags -
文章来源:http://www.tt-shopping.com/kevinlau/read.php/93.htm
posted on 2009-05-05 22:09 蓝冰飞寒 阅读(71) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: