I have 2 windows opened in my Java swing program. If I close one window, the programs stops execution. Is there any way not to stop the execution and play with the other window? Please explain with a sample code as I am new to swings. I tried searching in web, but I think I am lacking proper keywords for this.
Share
You’re probably setting your new windows’ close operations to
EXIT_ON_CLOSE. Look for places where this happens in your code:And replace
EXIT_ON_CLOSEwithDISPOSE_ON_CLOSEfor all but the window that you want to have exit the application when closed.Also take a look at the other
ON_CLOSEvalues that you can pass in thesetDefaultCloseOperationjavadocs.