Is there any way to find out the key pressed events in Java?? I am not talking about awt classes, i want to use them in my stand alone program. Specifically i want to catch the event of pressing Ctrl+C ( which is used to stop the program ) and execute some manipulations before actually shutting down my program. Any help in this regard is highly appreciated.
There's a method called addShutdownHook in java.lang.Runtime. Shutdown hooks are called when the virtual machine is shutting down -- even if the user pressed Control-C.
This guy is skipping without a rope. At least, that's what this tiny ad said: