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?

Was it helpful?

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:

Useful example of a shutdown hook in Java?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top