aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exiting from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exiting from Applet" Watch "Exiting from Applet" New topic
Author

Exiting from Applet

Shah Chunky
Ranch Hand

Joined: Dec 27, 2000
Posts: 116
Hello all...
I have created an applet with 2 Buttons & on clicking 1 button i want to exit the appletviewer.
Below is the code for ActionEvent:-
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==button)
{
System.out.println("exit ");
destroy();
System.exit(1);
}
}
The above code is throwing Exception.
Can someone help me ?.
Thanks.

Shah Chunky - Sun Certified Java2 Programmer.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
You exit the appletviewer by closing the window.
System.exit() is not allowed in applets - the reason should be clear after a moment's reflection. The browser JVM may be executing any number of applets in a page, it makes no sense to let one of them stop the system.
Bill

------------------
author of:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exiting from Applet