如何通过代码关闭java Applet [英] How to close java Applet through code
问题描述
我正在开发一个 Java 小程序.我希望它被代码关闭.我使用了 System.Exit(0)
但它不起作用.有没有其他方法可以实现这一点?
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?
谢谢
推荐答案
applet.getAppletContext().showDocument("ThanksForUsingOurApplet.html");
关于签名小程序可以调用System.exit(n)
的注释.
As to the comment that a signed applet can call System.exit(n)
.
它可以在某些浏览器/JRE 组合中.它不能在其他浏览器中.在它可以的情况下,不应该因为小程序可能与其他小程序共享一个 VM(现在不太常见),即使不能,用户也有责任通过以下方式关闭小程序关闭页面.
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.
小程序是网页中的访客.调用System.exit(n)
就像烧掉宾馆一样.
An applet is a guest in a web page. Calling System.exit(n)
is like burning down the guest house.
这篇关于如何通过代码关闭java Applet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!