posted 20 years ago
the method addShutdownHook() in java.lang.Runtime might help you. if you run and compile this you can cvrtl-c it during the loop and the hook class's start() will be called by the runtime.
it seems to offer you the chance to define some behaviours under the circumstances you describe. it handles ctrl-c anyway - you would have to code some testable behaviour into the run() method (e.g. write a file) for window-close because, of course, the window is closed.
note : you will need to be on a 1.3 JRE for this.
good luck
peter
[ June 13, 2003: Message edited by: peter greaves ]