作业帮 > 综合 > 作业

The method wiodowClosing() from the type new WindowAdapter()

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/06/13 12:01:14
The method wiodowClosing() from the type new WindowAdapter(){} is never used locally java的错误信息
使用注解方式虽然可以清除警告,但是关闭窗口的命令无法实现,也就是自己public void WindowClosing(WindowEvent we) 的方法不能用到.
The method wiodowClosing() from the type new WindowAdapter()
提示的意思是你这个函数没有在这个程序中北调用过,你按照下面这格式添加响应事件,我测试过了.CloseFrameDemo 就是你创建的那个药关闭的窗体的类名.
public CloseFrameDemo() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent arg0) {
JOptionPane.showMessageDialog(null,"正在关闭!");
}
});