![e551. 精简的Applet e551. 精简的Applet](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
Every applet must subclass Applet
.
import java.applet.*;
import java.awt.*; public class BasicApplet extends Applet {
// This method is called once by the browser when it starts the applet.
public void init() {
} // This method is called whenever the page containing this applet is made visible.
public void start() {
} // This method is called whenever the page containing this applet is not visible.
public void stop() {
} // This method is called once when the browser destroys this applet.
public void destroy() {
} // This method is called whenever this applet needs to repaint itself.
public void paint(Graphics g) {
}
}
Here is an example of an HTML file that will cause the browser to load and start the applet:
<applet code=BasicApplet width=100 height=100>
</applet>
Related Examples |