import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class AnotherTest extends Frame implements ActionListener
{

Button bn;

public AnotherTest()
{
     bn=new Button("退出");    
     bn.setVisible (true);
     Label lb =new Label("这是一个测试");
     lb.setVisible (true);
     this.add(lb,BorderLayout.NORTH);
     this.add(bn,BorderLayout.SOUTH);
     bn.addActionListener(this);
    
     this.setSize (400,400);
     this.setTitle ("java学习");
     this.setVisible (true);
     //test.addWindowListener (we);
}

  public static void main(String args[])
  {
    AnotherTest test =new AnotherTest();
    test.show();        
  }
  public void actionPerformed(ActionEvent e)
{
Component com=(Component)e.getSource();
if(com.equals(bn))
System.exit(0);

}
}