An applet is not allowed to call System.exit
. Other applets made by other people may be using that JVM, after all.
In general, an applet "ends" when the user chooses to close or leave the page (which causes the applet's stop
method to be called). The applet cannot decide on its own when its operation ends.
In theory, you could make your applet display a blank rectangle or something, but really, an "Exit" function simply doesn't make sense in an applet, and shouldn't be present to begin with.