更新时间:2021-08-26 22:28:44
我用Google搜索并找到了解决方案,是这样的:
I googled and i find the solution, and is this:
WindowEvent closingEvent = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(closingEvent);
frame.setVisible(true);
它使用WindowEvent进行与"x"点击相同的操作.
It uses a WindowEvent to do the same as "x" click does.
无论如何,谢谢你们的帮助!
Thank you guys anyway for your help!!!