Hi friend,
An applet is a software component that runs in the context of another program, for example a web browser. A program designed to be executed from within another application. Unlike an application, applets cannot be executed directly from the operating system. With the growing popularity of OLE (object linking and embedding), applets are becoming more prevalent. A well-designed applet can be invoked from many different applications.
Web browsers, which are often equipped with Java virtual machines, can interpret applets from Web servers. Because applets are small in files size, cross-platform compatible, and highly secure (can't be used to access users' hard drives), they are ideal for small Internet applications accessible from a browser.
---------------------------------------
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
public class GridDrawingApplet extends Applet {
public void paint (Graphics g) {
// Draw the vertical lines:
g.drawLine (0,0, 0,240);
g.drawLine (30,0, 30,240);
g.drawLine (60,0, 60,240);
g.drawLine (90,0, 90,240);
g.drawLine (120,0, 120,240);
g.drawLine (150,0, 150,240);
g.drawLine (180,0, 180,240);
g.drawLine (210,0, 210,240);
g.drawLine (240,0, 240,240);
// Draw the horizontal lines:
g.drawLine (0,0, 240,0);
g.drawLine (0,30, 240,30);
g.drawLine (0,60, 240,60);
g.drawLine (0,90, 240,90);
g.drawLine (0,120, 240,120);
g.drawLine (0,150, 240,150);
g.drawLine (0,180, 240,180);
g.drawLine (0,210, 240,210);
g.drawLine (0,240, 240,240);
}
}
---------------------------------
<HTML>
<BODY>
<div align = "center">
<APPLET CODE = "GridDrawingApplet.class" WIDTH = "400" HEIGHT = "300"></APPLET>
</div>
</BODY>
</HTML>
------------------------------------------
Visit for more information:
http://www.roseindia.net/java/example/java/applet/Thanks.