This program is only for beginners in Java. Following program just gives you a gist of how an Applet must look like and what is the basic structure. There are actually five phases in an applet which are not explicitly shown here. The width and height values must be given and there are no default values which will automatically be taken by the compiler. The paint () method is the one which is capable of displaying anything onto the screen.
// SIMPLE APPLET PROGRAM
// Created by Karthik Sampath on 28/4/2010.
// Copyright 2010, Karthik. All rights reserved.
// The copyright to the computer program(s) herein
// is the property of Karthik Sampath, India. The
// program(s) may be used and/or copied only with the
// written permission of Karthik Sampath or in accordance
// with the terms and conditions stipulated in the
// agreement/contract under which the program(s) have
// been supplied. This copyright notice must not be
// Published in www.geekyard.com
// <applet code=”hello” width=500 height=460> </applet>
public class appdraw extends Applet
public void paint(Graphics g)
g.drawRect(10, 60, 30, 50);