Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does my JFrame go away after I choose system close on the window?

away jframe system window
0
10 Posted

Why does my JFrame go away after I choose system close on the window?

0
10

Ans : Assume that you have a Swing JFrame component, and you handle the windowClosing event, but do nothing in the handler. You will see that the JFrame disappears anyway. The reason is that JFrame’s have default handling of the system close operation, separate from the windowClosing event. You have to override that by calling: setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); on your JFrame.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123