Good morning!

Need help with event handling. The problem is that I have a program in which there is a video. The video opens in a separate window. Pier closes the window, the video continues to play. I visited to register a trip, but all the time it gives an error. How to solve this problem? I will be sincerely grateful for the help.

  • show me how to turn off the stream from the video - Mikhail Ketov

2 answers 2

Throw the leafer to close the window, and in it realize the shutdown of the video stream

    Make it so that you kill either the thread or the program):

    stage.setOnCloseRequest(event -> { //тут убиваешь поток с видео //ну или закрываешь программу так) System.exit(-1); });