浏览走的时候Java小程序没有被杀死 [英] Java Applet not killed when browsing away

查看:262
本文介绍了浏览走的时候Java小程序没有被杀死的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何停止的Java Applet的过程中,当用户从导航小程序已经从加载的页面吗?

How do I stop the process of a Java Applet when a user navigates away from the page the applet has been loaded from?

我使用的Chrome和现在杀小程序,我不得不使用窗口的任务栏和终止进程的java.exe

I am using Chrome, and for now to kill the applet, I have to use window's taskbar and kill the process java.exe

推荐答案

Java小程序有生命周期方法。这些都是的init 启动停止摧毁。你应该学会使用它们,但更重要的,那么当浏览器调用每一个这种方法的学习。

Java applets have lifecycle methods. Those are init, start, stop and destroy. You should learn to use them, but what's more important, you should learn when a browser calls each of this method.

当您从页面导航离开,停止被调用,你应该停止你发表的主题启动和如果您分配的任何清理的资源。浏览器不杀JVM上的每个页面重新加载,因为它会通过极其低效(及其他原因),所以如果要停止无论你的小程序是干什么的,实现它在停止方法。

When you navigate away from your page, stop is called and you should stop threads you started in start and cleanup resources if you allocated any. Browsers do not kill JVM on every page reload because it would by extremely inefficient (and for other reasons), so if you want to stop whatever your applet is doing, implement it in stop method.

另外这里看到和页面上的其他环节,作进一步的解释。

Also see here and other links on that page, for further explanation.

这篇关于浏览走的时候Java小程序没有被杀死的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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