- 使用WindowListener接口实现窗口关闭事件:
frame.addWindowListener(new WindowAdapter() {@Overridepublic void windowClosing(WindowEvent e) {frame.dispose();}});- 通过调用dispose()方法关闭窗口:
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);- 使用System.exit(0)关闭窗口及应用程序:
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);上一篇:java中lamda的应用场景有哪些
下一篇:C++中的lambda表达式怎么使用
jframe









