洪涛是同志:java中关于适配器的使用?

来源:百度文库 编辑:高考问答 时间:2024/04/29 03:33:59
import java.awt.*;
import java.awt.event.*;
public class EventTest extends WindowAdapter
{
public static void main(String args[])
{
Frame fr=new Frame("good");
fr.setSize(200,200);
fr.setBackground(Color.red);
fr.setLayout(null);
fr.addWindowListener(new EventTest());
fr.setVisible(true);
}
public void windowClosing(WindowEvent e)
{System.exit(1);}
}
我只是想让打开后的窗体关上为什么不行?(详细点)
经运行多次出现
EventTest.java:3 no interface expected here
public class EventTest extends WindowAdapter
^
我在抓狂~~

我运行了一下,好用啊!

推荐使用JFrame,不用加关闭,自动就有!

可能跟天气有关!

的确没问题~~~~你看看是不是抄错啥东西了?比如WindowListener