I’m new to Java desktop application. How do I make the application exit only when there is no frame open? In VB.NET there is an option in the project properties that says “Exist when last form closes” something like that.
Basically I have two frames, Login and MainMenu. The Login shows first, and when the user successfully logged in, the Login will be closed and the MainMenu will open.
You can put all your frames in a
Listadd a window closing event to each of the frame and remove it from the list on window close.If the list contains no element you can exit the application.Additionally you can use
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);