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

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

问题描述

我有一个 JApplet,它添加了一个 JPanel.我在其中播放了一些音乐,但是当我关闭网络浏览器时,Java 仍在运行并播放音乐.

我找不到任何关于此的信息,但是有没有办法覆盖或捕获关闭事件?我想做一个 music.stop() 或其他类似的清理工作,以尝试让它以更优雅的方式关闭.

解决方案

void destroy()

<块引用>

由浏览器或小程序查看器调用以通知此小程序它正在被回收并且它应该销毁它已分配的所有资源.

void stop()

<块引用>

由浏览器或小程序查看器调用以通知此小程序应停止执行.

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天全站免登陆