还是在看Java Tutorial,到了"Applets"。
下面就列出一些看到的重点吧。
An applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web - page and runs in the context of the browser. An applet must be a subclass of the java.applet.Applet class , which provides the standard interface between the applet and the browser environment.
applet是一种特殊的JAVA程序,允许带有Java技术的浏览器能够从Internet下载它并运行。applet是典型的嵌入到网页里面并在浏览器上下文中运行的。applet必须是java.applet.Applet类的子类,java.applet.Applet提供applet和浏览器环境之间的接口标准。
Swing provides a special subclass of Applet, called javax.swing.JApplet, which should be used for all applets that use Swing components to construct their GUIs.
Swing提供一个特殊的applet子类,叫做javax.swing.JApplet,当所有的applet要用到Swing部件来构造他们的GUI时,那么它就需要用到它。
By calling certain methods, a browser manages an applet life cycle, i f an applet is loaded in a web page.
如果applet已经加载到一个网页中,那么通过调用applet的某一方法,浏览器可以控制applet的生命周期。
applet是一种特殊的JAVA程序,允许带有Java技术的浏览器能够从Internet下载它并运行。applet是典型的嵌入到网页里面并在浏览器上下文中运行的。applet必须是java.applet.Applet类的子类,java.applet.Applet提供applet和浏览器环境之间的接口标准。
Swing provides a special subclass of Applet, called javax.swing.JApplet, which should be used for all applets that use Swing components to construct their GUIs.
Swing提供一个特殊的applet子类,叫做javax.swing.JApplet,当所有的applet要用到Swing部件来构造他们的GUI时,那么它就需要用到它。
By calling certain methods, a browser manages an applet life cycle, i f an applet is loaded in a web page.
如果applet已经加载到一个网页中,那么通过调用applet的某一方法,浏览器可以控制applet的生命周期。
上面讲了applet的一些知识,接下来的就是applet的生命周期的讲解了:
方法地地Life Cycle of an Applet: Basically, there are four methods in the Applet class on which any applet is built.
Applet的生命周期:基本上,在Applet类的每个实例中有四个方法。
init: This method is intended for whatever initialization is needed for your applet. It is called after the param attributes of the applet tag.
init:这个往往用来执行你的applet需要做的所有初始化工作,当在applet标记中的param属性读入后开始调用。
start: This method is automatically called after init method. It is also called whenever user returns to the page containing the applet after visiting other pages.
start:此方法在init方法调用完后自动调用,它是执行访问其它页面后用户重新返回到包含applet的页面中时的操作。
stop: This method is automatically called whenever the user moves away from the page containing applets. You can use this method to stop an animation.
stop:此方法当用户从包含applet的页面中离开时自动调用,你能够用此方法来停止你的动画。
destroy: This method is only called when the browser shuts down normally.
destroy:此方法仅当正常地关闭浏览器时被调用。
Thus, the applet can be initialized once and only once, started and stopped one or more times in its life, and destroyed once and only once.
因此,applet仅能用init一次,能够在它的生命中被start和stop一次或多次,同时也仅能被destroy一次。
Applet的生命周期:基本上,在Applet类的每个实例中有四个方法。
init: This method is intended for whatever initialization is needed for your applet. It is called after the param attributes of the applet tag.
init:这个往往用来执行你的applet需要做的所有初始化工作,当在applet标记中的param属性读入后开始调用。
start: This method is automatically called after init method. It is also called whenever user returns to the page containing the applet after visiting other pages.
start:此方法在init方法调用完后自动调用,它是执行访问其它页面后用户重新返回到包含applet的页面中时的操作。
stop: This method is automatically called whenever the user moves away from the page containing applets. You can use this method to stop an animation.
stop:此方法当用户从包含applet的页面中离开时自动调用,你能够用此方法来停止你的动画。
destroy: This method is only called when the browser shuts down normally.
destroy:此方法仅当正常地关闭浏览器时被调用。
Thus, the applet can be initialized once and only once, started and stopped one or more times in its life, and destroyed once and only once.
因此,applet仅能用init一次,能够在它的生命中被start和stop一次或多次,同时也仅能被destroy一次。
