I want to call one function when my JavaFX program close. I have few classes which extends Stage. So i don't know in which stage my program will close.
So the first way to do this is to override close function in every stage i got and to call my function from there.
But i guess that there should be also other way. Is there any final function that is always called just before our program close ? So i can implement that function to put what i need to be done before program closes in there ?
Override stop() in your Application subclass:
public class MyApp extends Application {
@Override
public void start(Stage primaryStage) {
// startup code...
}
@Override
public void stop() {
// executed when the application shuts down
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With