Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exiting from Applet

 
Shah Chunky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic