JAVA高手帮我找个错误啊!

来源:百度知道 编辑:UC知道 时间:2024/05/11 19:44:51
//************************************************
//founction name:windowClosing()
//parameter :none
//return :void
//attribute :public
//founction :close the frame
//************************************************
public void windowClosing(WindowEvent e){ //close the window
System.exit(0);
}//关闭窗体功能

贴完整程序啊

class WinListener extends WindowAdapter{
public void windowClosing (WindowEvent l){
System.exit(0);
}
}

this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
放在你的主类里面就可以了

楼主注意看题:
parameter :none
人家没让你带参数,你WindowEvent e肯定是错误的咯。。。

public void windowClosing(){
System.exit(0);
}

参数为none,而真正的方法中又有WindowEvent e
我想这就是错误所在!