/**
* Called by the browser or applet viewer to inform this applet that it has
* been loaded into the system. It is always called before the first time
* that the start
method is called.
*
* A subclass of Applet
should override this method if it has
* initialization to perform. For example, an applet with threads would use
* the init
method to create the threads and the
* destroy
method to kill them.
*
* The implementation of this method provided by the Applet
* class does nothing.
* 补充:JVM加载applet类,浏览器创建applet,浏览器调用init方法进行初始化,如果Applet的子
* 类具有初始化操作应覆盖此方法。通常,该方法实现的功能包括创建用户界面组件、装载图像和音频等资源
* 以及从HTML网页的标记中获取参数
*/
public void init() {
}
/**
* Called by the browser or applet viewer to inform this applet that it
* should start its execution. It is called after the init
* method and each time the applet is revisited in a Web page.
*
* A subclass of Applet
should override this method if it has
* any operation that it wants to perform each time the Web page containing
* it is visited. For example, an applet with animation might want to use
* the start
method to resume animation, and the
* stop
method to suspend the animation.
*
* Note: some methods, such as getLocationOnScreen
, can only
* provide meaningful results if the applet is showing. Because
* isShowing
returns false
when the applet's
* start
is first called, methods requiring
* isShowing
to return true
should be called from
* a ComponentListener
.
*
* The implementation of this method provided by the Applet
* class does nothing.
* 补充:init方法完成后,调用start方法,浏览过别的网页之后回来也调用此方法
*/
public void start() {
}
/**
* Called by the browser or applet viewer to inform this applet that it
* should stop its execution. It is called when the Web page that contains
* this applet has been replaced by another page, and also just before the
* applet is to be destroyed.
*
* A subclass of Applet
should override this method if it has
* any operation that it wants to perform each time the Web page containing
* it is no longer visible. For example, an applet with animation might want
* to use the start
method to resume animation, and the
* stop
method to suspend the animation.
*
* The implementation of this method provided by the Applet
* class does nothing.
* 补充:离开页面时调用stop方法
*/
public void stop() {
}
/**
* 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. The stop
method will always be called before
* destroy
.
*
* A subclass of Applet
should override this method if it has
* any operation that it wants to perform before it is destroyed. For
* example, an applet with threads would use the init
method to
* create the threads and the destroy
method to kill them.
*
* The implementation of this method provided by the Applet
* class does nothing.
*/
public void destroy() {
}