events - Calling function when program exits in java -
i save programs settings every time user exits program. need way call function when user quits program. how do that?
i using java 1.5.
you can add shutdown hook application doing following:
runtime.getruntime().addshutdownhook(new thread(new runnable() { public void run() { // want } }));
this equivalent having try {} {} block around entire program, , encompasses what's in block.
please note caveats though!
Comments
Post a Comment