Why when I click on the x button to close the window in a Java application only the window dissapears and the applicaton is still running.
I’ve read so many times that java designers tried to cater Java behaviour for the most common needs of programmers and save they precious time and so on and so on. What’s more common case than closing app when I click on a X button?
Whatever the reason is, it really doesn’t matter as long as you’re aware of how it works and how to make your program behave the way you want.
At a guess though: One app can have several windows, exiting the app when one of them is closed doesn’t sound very smart. Keeping track of how many windows are open/closed/hidden/not yet shown and so fort to be able to exit when the last windows is closed might have been too much work/too many edge cases etc. Thus it’s up to us, programmers, when we want our app to exit.
In any case, if you want your app to exit when a window(JFrame) is closed, you can just tell it to do so: