编了个简单的程序...但有报错,找不出原因...
import java.awt.event.WindowAdapter;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class MainFrame extends JFrame{
MainFrame(){
setBounds(100,100,800,550);
setTitle("网络设备管理系统");
setVisible(true);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){  //WindowEvent cannot be resolved to a type ?????? 这里出现错误.
setVisible(false);
dispose();
System.exit(0);
}
}
);  
}
public static void main(String[] args) {
MainFrame window=new MainFrame();
}}

解决方案 »

  1.   

    加上 import java.awt.event.WindowEvent;
      

  2.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【cswudafeng】截止到2008-07-01 20:30:59的历史汇总数据(不包括此帖):
    发帖的总数量:26                       发帖的总分数:910                      
    结贴的总数量:20                       结贴的总分数:590                      
    无满意结贴数:2                        无满意结贴分:40                       
    未结的帖子数:6                        未结的总分数:320                      
    结贴的百分比:76.92 %               结分的百分比:64.84 %                  
    无满意结贴率:10.00 %               无满意结分率:6.78  %                  
    楼主加油
      

  3.   

    WindowEvent cannot be resolved to a type
    WindowEvent 不能被解析
    把包导入就行了import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JFrame;class MainFrame extends JFrame {
    MainFrame() {
    setBounds(100, 100, 800, 550);
    setTitle("网络设备管理系统");
    setVisible(true);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { 
    setVisible(false);
    dispose();
    System.exit(0);
    }
    });
    } public static void main(String[] args) {
    MainFrame window = new MainFrame();
    }
      

  4.   

    加上 import java.awt.event.WindowEvent;