2

如何从我使用过的代码中关闭小程序System.exit(0)但它只会抛出一堆异常并且它没有关闭它。我知道关闭小程序是用户的责任,但是还有什么办法吗?

4

2 回答 2

3

不要调用System.exit(0)小程序。这可能会导致浏览器关闭。

更好的方法是在 a 中运行应用程序JFrame并使用Java Web Start来启动应用程序。

于 2012-11-22T13:24:08.233 回答
2

actionPerformed(ActionEvent)方法中,调用..

// end the applet by navigating to the 'applet ended' URL
applet.getAppletContext().showDocument(appletCloseURL);
于 2012-11-22T14:35:55.500 回答