java, Declaring an method which runs before application close
-
13-12-2019 - |
Question
I want to make some actions just before my application close.
I see there are action listeners but i have no frame or similar thing. Just an only java file.
How can I able to set some kind of control?
Solution
I want to make some actions just before my application close.
You're probably looking for a shutdown hook:
Runtime.getRuntime().addShutdownHook(...)
Here's a SO question (and great answers) asking for practical uses of shutdown hooks:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow