对于小程序关闭的事件? [英] Close event for applet?

查看:758
本文介绍了对于小程序关闭的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 JApplet的,增加了一个的JP​​anel 。我在播放一些音乐,但是当我关闭Web浏览器的Java仍在运行和播放音乐。

我找不到这个东西,但有没有办法覆盖或赶上关闭事件?我希望做一个 music.stop()或其他类似的大扫除,试图得到它关闭在一个更优雅的方式。


解决方案

 无效的destroy()


  

通过浏览器或applet viewer调用,通知此applet它正在被回收,它应该销毁分配给它的任何资源。


 无效停止()


  

通过浏览器或applet viewer调用,通知此applet它应该终止执行。


I have a JApplet that adds a JPanel. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆