开发者

Event between X clicked/alt-F4 and windowsclosing() event

开发者 https://www.devze.com 2023-01-26 05:52 出处:网络
I\'m making a application with a main JFrame and some threads. I use a windowslistener on my frame to detect for the closing event. But sometimes when i close the application (closing the mainframe),

I'm making a application with a main JFrame and some threads. I use a windowslistener on my frame to detect for the closing event. But sometimes when i close the application (closing the mainframe), there is delay due to the threads. it appears that swing wait for all thread finish before calling the window开发者_Python百科sclosing() function. That delay can be a bit long (1-30seconds) so i would like to show a messagedialog "closing" like eclipse because for the user it seems that the application is not responding.

How can i get the event when the user attemp to close the windows not when the windows is actually closing ?

Sorry for my english :)

Thks in advance


You should close you threads manually. And there is two events callbacks: WindowClosing and WindowClosed

0

精彩评论

暂无评论...
验证码 换一张
取 消