问题
I've a project which is a randomizer. The randomizer gives a random number (of course) which is used to call a random game.
For now, I only have one game.
When I run the randomizer to get the game, everything works and it loads the game flawlessly.
But, when I close the window which was created for the random game, it also closes the parent window which gives the user access to the randomizer.
I am not sure as to why this is happening.
I tried refactoring the name of my shell as well as my display, wondering if this closing was occurring because they shared names, but that didn't fix anything.
I'm not sure why this is happening or what code would prevent this from happening.
Any thoughts would be much appreciated!
Thanks!
Nathan
回答1:
The issue was that there was a JFrame invoking frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);. This was forcing all windows closed. Turning this off fixed the issue.
来源:https://stackoverflow.com/questions/29707413/eclipse-closes-all-shells-when-one-is-closed