Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

applets

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What code shall I write below:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class ExitFromApplet extends Applet implements ActionListener {
public void init() {
Button exit = new Button("Exit");
exit.addActionListener(this);
add(exit);
}
public void actionPerformed(ActionEvent e) {

// what is the code that when "Exit" Button pressed
// the applet will close itself and exit from it.
}
} // end class
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Unfortunately there is no such code. The applet start and finish is controlled by the browser (and or course the user). You DON"T want to use System.exit() because it will kill the entire JVM not just your applet.
You name doesn't meet the naming convention here at the ranch. Please read it here and register again.
Thanks,
Manfred.
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic