Steps to create and execute an applet
1. Open Notepad
2. Type the java code of program :
import java.applet.*;
import java.awt.*;
public class FirstApplet extends Applet{
public void paint(Graphics g){
g.drawString("HELLO JAVA",40,20);
}
}
Rules for creating applets
1. Every applet should be public
2. Every applet should inherit applet class
3. Save it (FirstApplet.java)
4. Compile it-
5. Create an Html Document- Open Notepad, Type the following
HTML code of the program:
6. Open the html file or C:\data>appletviewer myapplet.html or write the applet as comment with in java file .
No comments:
Post a Comment