Thursday, April 16, 2009

How to create a simple applet

Steps in creating an Applet
(An applet is a java program that runs in the web browser)

1. The java.applet package must be included.

2. The class must extend from the Applet class.

3. Writing and compiling the Java code.

4. Writing a HTML code that will run the applet.

A Simple Applet

import java.applet.*;
public class MyApplet extends Applet{}
HTML Code

<html>

<body>
<title>Applet Test Page</title>
<h1>Applet Test Page</h1>
<applet code="MyApplet.class" width=250 height=250 name="MyApplet">
</applet>

</body>
</html>

No comments:

Post a Comment