Java and HTML

Back Up Next

 

Java and HTML
Useful General Syntax
<APPLET
	CODE="applet-class" WIDTH=width-in-pixels
	HEIGHT=height-in-pixels [ARCHIVE="jar-filename"]
	[CODEBASE="where-is-the-root-location-of-the-applet"]
	[ALIGN="left,right,top,bottom,center..."]
	[ALT="Text-browser-displays-if-applet-can't-be-run]
	...other applet options
>
[<PARAM NAME=applet-parameter-1 VALUE=value1]
[<PARAM NAME=applet-parameter-2 VALUE=value2]
...
HTML that browser displays if applet did not run
</APPLET>
Must specify
CODE
where is the applet class located?
MyApplet[.class]
WIDTH, HEIGHT
how big an area in the browser does the applet get?
Useful
CODEBASE
Applets can depend on this to load images using relative URL
ALT
Be nice to surfers that don't turn on Java!
ALIGN
How the applet is positioned within the browser
ARCHIVE
If applet is in a JAR file, specify where the JAR file is
Applet embedded in HTML Example
HelloWorldApplet.java
HelloWorldApplet.html