The simplest applet


This browser does not understand the APPLET tag and does not support Java.
(1) Telnet to acf5.nyu.edu and put the name of the alpha_osf32 subdirectory of the directory /usr/local/java/bin into the environment variable SYSNAME:
setenv SYSNAME alpha_osf32c
echo $SYSNAME
You can put the setenv into your .login file.

(2) Then create a file named MyApplet.java in your public_html directory, containing

import java.applet.*;	//Applet Package
import java.awt.*;	//Abstract Windowing Toolkit Package

public class MyApplet extends Applet {
	public void paint (Graphics g)
	{
                g.setColor (Color.blue);
                g.drawRect (0, 0, 20, 10);
                g.drawString ("lower left", 0, 99);

                g.setColor (Color.red);
		g.drawLine (149, 0, 149, 99);	//down the right edge
	}
}

(3) Compile and chmod the applet like this:

javac -verbose MyApplet.java
chmod 444 MyApplet.class
ls -l MyApplet.*

(4) Write the following in one of your web pages in your public_html directory:

<APPLET CODE = "MyApplet.class" WIDTH = 150 HEIGHT = 100
ALT = "This browser understands the APPLET tag but does not have Java enabled now.">
This browser does not understand the APPLET tag and does not support Java.
</APPLET>
But the World Wide Web Consortium wants you to write
<OBJECT CODETYPE = "application/java" CLASSID = "java:MyApplet.class" WIDTH = 150 HEIGHT = 100>
This browser does not understand the OBJECT tag and does not support Java.
</OBJECT>

(5) After editing your web page, reload it with Netscape's option-Reload.