虽然导入了找不到符号WindowAdapter

时间:2013-06-28 21:54:22

标签: java windowlistener

我正在写一个小JFrame,但它不会找到WindowAdapter,虽然我正在导入它。

import java.awt.event.*; //WindowAdapter should be within this...
import javax.swing.*;

public class Test extends JFrame{

    public Test(){
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdatper() {
            public void windowClosing(WindowEvent e) {
                System.out.println("EXIT!!!!");
            }
        });
    }

    public static void main(String args[]){
        new Test();
    }
}

1 个答案:

答案 0 :(得分:1)

您将WindowAdapter()拼写为WindowAdatper()