Java applets are compiled java programs that can be run in a Java -enabled browser.
Use of 1.Applet
import Java.applet.Applet; import Java.awt.Graphics; public class Appletdemo extends Applet {@Override public void Paint (Graphics g) {g.drawstring ( "Hello applet!", 5, +); // draw text G.drawarc (80,50,40,40,20,360); // draw a circle }}
2.Applet program HTML file Writing
<HTML> <Head> <title>Applet</title> </Head> <Body> <appletsCODE= "Appletdemo.class"width= "+"Height= "+"></applets> </Body><HTML>
3.Applet Common Methods
ImportJava.applet.Applet;ImportJava.awt.Graphics; Public classAppletdemoextendsApplet {String mystring= ""; @Override Public voidPaint (Graphics g) {g.drawstring (mystring,5, 30); } Public voidinit () {mystring= mystring + "Initializing ..."; Repaint (); } Public voidstart () {mystring= mystring + "Starting program started ..."; Repaint (); } Public voidStop () {mystring= mystring + "Stopping execution program ..."; Repaint (); } Public voiddestroy () {mystring= mystring + "Recovering resources ..."; Repaint (); }}
4. Not to be continued ...
These are just concepts related to applets, basic methods for using applets , and embedding applets in HTML code. knowledge of the basic content of the program.
Java Web applet--java Applet