rurtubia
5/24/2015 - 2:36 PM

Java Applet class and its methods

Java Applet class and its methods

package kiloboltgame;

import java.applet.Applet;

public class StartingClass extends Applet{

}
package kiloboltgame;

import java.applet.Applet;

public class StartingClass extends Applet {
	@Override
	// Tests for errors upon compilation
	public void init() {
		// init(): Called by the browser or applet viewer to inform this applet 
		//that it has been loaded into the system.
		
		//super refers to the superclass (in this case Applet)
		super.init();
	}

	@Override
	public void start() {
		//Called by the browser or applet viewer to inform this applet 
		//that it should start its execution.

		super.start();
	}

	@Override
	public void stop() {
		//Called by the browser or applet viewer to inform this applet that it should stop its execution.

		super.stop();
	}

	@Override
	public void destroy() {
		//Called by the browser or applet viewer to inform this applet that it is being reclaimed 
		//and that it should destroy any resources that it has allocated.

		super.destroy();
	}
}
Structure for a simple applet.
Imports java.applet.Applet, extends applet.

Estructura para un applet simple.
Importa java.applet.Applet, extiende applet.