Event called when application is being closed
Use Runtime class to register a thread which will be called when the program is being closed.
Runtime.getRuntime().addShutdownHook(theHookThread);
Reference:
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29
留言
張貼留言