wood burning stoves
The moose likes Applets and the fly likes Doubt on closig JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Doubt on closig JApplet" Watch "Doubt on closig JApplet" New topic

Doubt on closig JApplet

ashok r

Joined: Aug 28, 2005
Posts: 9

i want to close applet on pressing JButton.but it si returning out error

can you pls send the code for closing the applet when pressing a button.
i tried using System.exit(0);
but it is not working

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Several points:

1) Your screen name does not conform to Javaranch rules. You have been asked before to change it - please do so.

2) An applet can't call System.exit due to security restrictions (unless it is signed).

3) What should happen if the applet is closed - should the web page it is embedded in be closed? That is tricky to do in the general case. Or does the applet open its own window? That should be easy to close, but the applet will still be there as part of the web page.

4) What error do you get? Show us the exception, and show us the relevant code section (not the whole applet).
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Why do you want to have a button to close an applet? Typically the user will "close" an applet by going to a different web page, either by entering an address manually or clicking on a link. This is the way applets should be designed to work.


Java API Documentation
The Java Tutorial
I agree. Here's the link: http://aspose.com/file-tools
subject: Doubt on closig JApplet
jQuery in Action, 3rd edition