Hi all,
on button click event, I'm creating the new JFrame instance for showing some Java 3D output.
But the code for windowClosed() method doesn't get executed at all,
but if I provided
for the same frame instance, then there is no problem
Note: J3DContainerFrame extends JPanel Any pointers ?
The windowClosed event is fired when the window has already closed. But it will not close if you allow it to close. You can do this by setting a proper default close operation. When you click the X it will fire the windowClosing event instead.
OK, that was a silly mistake, Next time I should look more carfully in Java Docs Thanks Michael & Rob for the quick and correct reply.
But my little knowledge of JFC forces me to ask this:
Why we need (separate) "windowClosed" event, can't we simply write all the code/logic related to "window closing/ed" thing in one method ?
Because you may want to be informed of both when the window is about to be closed (windowClosing), perhaps so you can block it, and when the window is actually closed (windowClosed), perhaps so you can do some clean-up.