'How to stop a jframe from closing when the program stops?

I am creating a window with a jframe. But when the program terminates the window closes. I want to the window to stay up even when the program closes.

The window doesn't have any functionality apart from displaying from text. I have tried to edit the default close process with:

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

But this doesn't stop the window from closes when the program stops. Is there a way to keep this window/jframe open even when the program stops?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source