Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Exiting from Applet  RSS feed

 
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.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
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
Boost this thread!