Q:

How to reset an applet so that the information is not piled up each time?

I'm writing a java applet with a reset button so that users can restart the app with a specified number of objects, and when the reset button is clicked, this method that I have defined gets called:
 public void reload(int new_number){
   init_num_objects =  new_number;
   this.destroy();
   this.init();
 }

This button technically does exactly what I want, it changes the value of a variable that init calls and restarts the applet:
public void init(){
  load_objects(init_num_objects);
}

The problem is that the more and more the user clicks the reset button, the slower the program (and consequently the user's computer) become. It's as if the applet is reloading each time without clearing memory space from the previous process. Is there a way to make the program just completely close and restart without slowing the client machine down?

A:

How to reset an applet so that the information is not piled up each time?

// in the applet..
this.getAppletContext().showDocument( this.getDocumentBase() );

The JVM will call stop() & destroy() automatically, refresh the page, and call init() and start().  Alter the document base URL to include a parameter for the 'count'.  Read the parameter using JS and write the new applet element accordingly.
I am not surprised things go wrong when the applet calls methods that are intended to be called automatically by the JVM.  

