Hi all,

I want to dispose a JFrame using a click-event. So I simply do this on Netbens.

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}

But it not work. Do you have any idea.

I just want to dispose all the visible JFrames. Actually I have only one JFrame visible. So this should work, but no luck. No any exceptions either on it.

And also I just want to dispose, not to exit the application.

Any idea?

Sorry for disturbing. Simply I can do it by diposing by calling dispose()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.