Close the Java program correctly when jdialog is the main window

I have a jdialog as the main window in my application (initially it was a JFrame, but it showed in the taskbar that I didn't want)

At present, I am doing:

setDefaultCloSEOperation(JDialog.DISPOSE_ON_CLOSE);

When I click the exit button:

frame.dispose();

But the process still seems to linger backstage

JFrame has JFrame EXIT_ ON_ Close, seems to have done what I want

How do I close my application correctly?

Solution

You can add

System.exit(0);

Where you want the program to end, perhaps after the dispose () line

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>