对于小程序关闭的事件? [英] Close event for applet?
问题描述
我有一个 JApplet的
,增加了一个的JPanel
。我在播放一些音乐,但是当我关闭Web浏览器的Java仍在运行和播放音乐。
我找不到这个东西,但有没有办法覆盖或赶上关闭事件?我希望做一个 music.stop()
或其他类似的大扫除,试图得到它关闭在一个更优雅的方式。
无效的destroy()
通过浏览器或applet viewer调用,通知此applet它正在被回收,它应该销毁分配给它的任何资源。
块引用>无效停止()
通过浏览器或applet viewer调用,通知此applet它应该终止执行。
块引用>I have a
JApplet
that adds aJPanel
. I play some music in this, but when I close the web browser Java is still running and playing music.I couldn't find anything on this, but is there a way to override or catch the close event? I'd like to do a
music.stop()
or other such housecleaning to try and to get it to shutdown in a more graceful manner.解决方案void destroy()
Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated.
void stop()
Called by the browser or applet viewer to inform this applet that it should stop its execution.
这篇关于对于小程序关闭的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!