1Install the tools that will let you build Java programs. Create a folder under your C drive and name it '"jdk." Visit the Sun Microsystems website and download the Java Development Kit (JDK) and the Java Runtime Environment (JRE) to that folder. Install these packages.
Step2Type the following source code on a Notepad:
import java.awt.*;
import java.applet.Applet;
public class MyFirstApplet extends Applet {
public void paint (Graphics g) {
g.drawString("This is my first Applet!!!", 100, 25);
}
}
Save the test file as "C:\MyFirstApplet.java."
Step3Compile the Java source code. This produces the Java applet. Click Start. Select Run. Type: "javac C:\MyFirstApplet.java". This will create file, 'MyFirstApplet.class'. It is your Java applet.
Step4Embed your Java applet into Hypertext Markup Language (HTML) code so you can see it through a browser. Open Notepad and type the following HTML script (replace starting and closing quotation marks with carrots):
"HTML"
"HEAD"
"TITLE"My First Applet"/TITLE"
"BODY"
"CENTER"
"APPLET CODE = 'MyFirstApplet.class' WIDTH = 100 HEIGHT = 25 "/APPLET"
"/CENTER"
"/BODY"
"/HTML"
Save it as, "C:\MyFirstApplet.html."
Step5Launch your default browser. Type, "C:\MyFirstApplet.html" in the URL space. Verify that you see "This is my first Applet!!!" in a rectangle in the middle of your browser page.
Thanks,
-яαηgєσχ
Step2Type the following source code on a Notepad:
import java.awt.*;
import java.applet.Applet;
public class MyFirstApplet extends Applet {
public void paint (Graphics g) {
g.drawString("This is my first Applet!!!", 100, 25);
}
}
Save the test file as "C:\MyFirstApplet.java."
Step3Compile the Java source code. This produces the Java applet. Click Start. Select Run. Type: "javac C:\MyFirstApplet.java". This will create file, 'MyFirstApplet.class'. It is your Java applet.
Step4Embed your Java applet into Hypertext Markup Language (HTML) code so you can see it through a browser. Open Notepad and type the following HTML script (replace starting and closing quotation marks with carrots):
"HTML"
"HEAD"
"TITLE"My First Applet"/TITLE"
"BODY"
"CENTER"
"APPLET CODE = 'MyFirstApplet.class' WIDTH = 100 HEIGHT = 25 "/APPLET"
"/CENTER"
"/BODY"
"/HTML"
Save it as, "C:\MyFirstApplet.html."
Step5Launch your default browser. Type, "C:\MyFirstApplet.html" in the URL space. Verify that you see "This is my first Applet!!!" in a rectangle in the middle of your browser page.
Thanks,
-яαηgєσχ



