java windowClosing无效
frame.addWindowListener(newWindowAdapter(){@OverridepublicvoidwindowClosed(WindowEven...
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent we){
super.windowClosing(we);
Storage storage = new Storage();
System.out.println("bbbb");
}
});//new Storage()和System.out.println("bbbb");都没执行
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we){
super.windowClosing(we);
Storage storage = new Storage();
System.out.println("bbbb");
});//new Storage()没执行,只执行了“System.out.println("bbbb");”
这是为什么?我是想在退出时执行new Storage()进行保存,要怎么才可以做到? 展开
@Override
public void windowClosed(WindowEvent we){
super.windowClosing(we);
Storage storage = new Storage();
System.out.println("bbbb");
}
});//new Storage()和System.out.println("bbbb");都没执行
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we){
super.windowClosing(we);
Storage storage = new Storage();
System.out.println("bbbb");
});//new Storage()没执行,只执行了“System.out.println("bbbb");”
这是为什么?我是想在退出时执行new Storage()进行保存,要怎么才可以做到? 展开
2015-08-05
展开全部
肯定有执行到,只是太慢了,给强制关闭了。。。。。。。。退出时,等待Storage完成。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询