• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
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:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!