triviumgo 发表于 2018-12-26 23:17:26

为什么说cannot be resolved to a type?

package cn.game;

import javax.swing.JFrame;


public class G1 extends JFrame{
        /*初始化窗口*/
       
        public void launchFrame() {
                this.setTitle("龙哥出品");
                this.setVisible(true);
                this.setSize(500, 500);
                this.setLocation(300, 300);
               
                this.addWindowListener(new WindowAdapter() {       /*为什么这两行说cannot be resolved to a type*/
                        public void windowClosing(WindowEvent e) {
                                System.exit(0);                        }
                });
               
        }

public static void main(String args[]) {
        G1 a=new G1();
        a.launchFrame();
}
}

zlj19931010 发表于 2018-12-27 09:07:29

你把包导齐
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
页: [1]
查看完整版本: 为什么说cannot be resolved to a type?