DISPOSE_ON_CLOSE 和 EXIT_ON_CLOSE 的区别

If you have several JFrames open and you close one that has EXIT_ON_CLOSE it will close all the JFrames and exit the app.

If you close one that has DISPOSE_ON_CLOSE only that one JFrame will be closed.

If you only have one JFrame there isn't a real difference unless you have other non-deamon threads running.

let's say you have an application which opens with a login dialog box

after logging in
DISPOSE_ON_CLOSE will dispose of the login dialog box, then proceed with the rest of the program
EXIT_ON_CLOSE will terminate the program

原文地址:https://www.cnblogs.com/fengjian/p/3479876.html