Writing the Applet

Hello World Applet with the AWT

import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorld extends Applet {
   public void paint(Graphics g) {
      g.drawString("Hello world!", 50, 25);
   } // paint
} HelloWorld

Same thing in Swing

import javax.swing.*; 
import java.awt.*; 

public class HelloWorld extends JApplet { 
   public void paintComponent(Graphics g) {
      g.drawString("Hello world!", 50, 25);
   } // init
} // HelloWorld

Writing the Applet Tag

Applet tag for AWT applets and Netscape 7

<APPLET CODE = HiNoteApplet WIDTH = 550 HEIGHT = 550 >
</APPLET>

Using Swing in older browsers via the plugin

<OBJECT 
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 550 HEIGHT = 550
codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
<PARAM NAME="code" VALUE = "HiNoteApplet">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">

<COMMENT>
    <EMBED> 
    type="application/x-java-applet;version=1.2" 
    pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"
    WIDTH = 550 HEIGHT = 550   
    CODE = "HiNoteApplet" 
    java_CODE = "HiNoteApplet" 
    <NOEMBED>
</COMMENT>
    If you see this text, then the Java plug-in is not installed
    properly on this machine.  You can download the java plugin
    from <a href="http://java.sun.com/products/plugin/1.2/plugin-install.html">Sun</a>
    </NOEMBED></EMBED>
</OBJECT>

Sun has written an applet tag converter. It is already installed on both ITD and CAEN.

It will change your file so it has the correct tag for using the plug-in.