如何通过code关闭Java小程序 [英] How to close java Applet through code

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

问题描述

我开发一个Java小程序。我希望它由code被关闭。我已经使用 System.Exit(0),但它不工作。还有什么其他的方法来实现这一目标?

感谢


解决方案

  applet.getAppletContext()showDocument(ThanksForUsingOurApplet.html);

至于评论说,签名Applet可以调用 System.exit(N)

它可以在一些浏览器/ JRE组合,它不能在其他人。因为它可以,它的不应的,因为一个小程序可以与其他小程序共享VM的那些(不常见的这些天),即使不是,它是用户的责任被关闭一个小程序关闭所述页

applet是在网页中做客。调用 System.exit(N)就像是烧毁宾馆。

I am developing a java applet. I want it to be closed by the code. I have used System.Exit(0) but it is not working. Is there any other method to achieve this?

Thanks

解决方案

applet.getAppletContext().showDocument("ThanksForUsingOurApplet.html");

As to the comment that a signed applet can call System.exit(n).

It can in some browser/JRE combos., it can't in others. In the ones that it can, it shouldn't since an applet may share a VM with other applets (less common these days), and even if not, it is the user's responsibility to close an applet by closing the page.

An applet is a guest in a web page. Calling System.exit(n) is like burning down the guest house.

这篇关于如何通过code关闭Java小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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