Click to See Complete Forum and Search --> : How do you stop a window frame from closing


Reza Beheshti
January 21st, 1999, 10:59 AM
Hi,

I am new to Java (Been doing C++ and VC++ for years though!), just started using VCafe 3.0.

I am trying to find a way to prevent a window from closing.

When I trap a "WindowClosing" message in WindowEvent, how do I stop it from getting further up to the UI chain and prevent the window closing?

Thank.

Zafir Anjum
January 23rd, 1999, 10:51 AM
After creating the frame call the function


frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );

dev
January 28th, 1999, 10:36 AM
After having trapped the "WindowClosing" message in WindowEvent just consume it

using consume method of .. I think of Event Class.

Zafir Anjum
January 29th, 1999, 10:50 AM
Actually this won't work. Swing does not check whether the event is consumed

but instead only looks at the 'closeoperation' flag.