wood burning stoves 2.0*
The moose likes Applets and the fly likes applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "applets" Watch "applets" New topic
Author

applets

nirajju
Greenhorn

Joined: Dec 01, 2001
Posts: 1
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
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
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.
 
 
subject: applets
 
Similar Threads
System.exit(0) applet
Mnemonics for menus in the applet
Error
The serializable class does not declare a static final...
applet size