java japplet_java常用类解析九:Applet(JApplet)详解及示例

  /**

* 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() {

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值