This Java applet uses the Java Plug-in supplied by Sun. It has
been tested and shown to work with the following browsers:
Microsoft Internet Explorer, Firefox, Mozilla, Camino, Netscape, Safari,
Konqueror, and Opera.
NOTE: Need Java 1.4 (or later version) Plug-in to run this applet, so if it does not work, get the latest Java Plug-in here.
Applet source code Sample2.java:: jar file Sample2.jar
object
tags
Read the other sections for an explanation on how this works and a how to includes a discussion about how to include code that will assist the user if their browser does not have a Java Plug-in or has a very old version of a Java Plug-in.
Sample2
and it and its supporting
classes are NOT archived within a jar file.
applet
tag)
<applet code="Sample2" height="300" width="550" > </applet>
object
tag)
<!--[if !IE]>--> <object classid="java:Sample2.class" type="application/x-java-applet" height="300" width="550" > <!--<![endif]--> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="300" width="550" > <param name="code" value="Sample2" /> </object> <!--[if !IE]>--> </object> <!--<![endif]-->
Sample2
and it and its supporting
classes are archived within a jar file
named Sample2.jar
.
applet
tag)
<applet code="Sample2" archive="Sample2.jar" height="300" width="550" > </applet>
object
tag)
<!--[if !IE]>--> <object classid="java:Sample2.class" type="application/x-java-applet" archive="Sample2.jar" height="300" width="550" > <!-- Konqueror browser needs the following param --> <param name="archive" value="Sample2.jar" /> <!--<![endif]--> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="300" width="550" > <param name="code" value="Sample2" /> <param name="archive" value="Sample2.jar" /> </object> <!--[if !IE]>--> </object> <!--<![endif]-->
Applets
and
is named Sample
and it and its supporting
classes are NOT archived within a jar file and it
uses two parameters to pass in information to the applet.
applet
tag)
<applet code="Sample" codebase="Applets" height="300" width="550" > <param name="alpha" value="Bubba" /> <param name="beta" value="Ethel" /> </applet>
object
tag)
<!--[if !IE]>--> <object classid="java:Sample.class" type="application/x-java-applet" height="300" width="550" > <param name="codebase" value="Applets" /> <param name="alpha" value="Bubba" /> <param name="beta" value="Ethel" /> <!--<![endif]--> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="300" width="550" > <param name="codebase" value="Applets" /> <param name="code" value="Sample" /> <param name="alpha" value="Bubba" /> <param name="beta" value="Ethel" /> </object> <!--[if !IE]>--> </object> <!--<![endif]-->
NOTE:
classid
tag. The parameters
to the Plug-in are then passed via the param
tags. MSIE uses the inner nested object and Firefox/others will use
the outer object.
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
,
the latest installed version of the Java
plug-in is used. For further information, see
Using OBJECT, EMBED and APPLET Tags in Java Plug-in
.
classid
tag) and will use only the outer object.
<!--[if !IE]>
<![endif]-->
NOTE: (Extra Features for handling Java Plug-in problems)
The example code that follows uses features that aid the user if
their browser either does not have a Java Plug-in or has an older
version of the Java Plug-in.
codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"Microsoft Internet Explorer will automatically get the Java 1.5 Plug-in. Getting the Java 1.5 Plug-in will occur when the browser either does not have a Java Plug-in or when the browser has an earlier version of the Java Plug-in than is needed. For further information, see Using OBJECT, EMBED and APPLET Tags in Java Plug-in .
<strong> This browser does not have a Java Plug-in. <br /> <a href="http://java.sun.com/products/plugin/downloads/index.html"> Get the latest Java Plug-in here. </a> </strong>If the browser is Firefox/others and there is no Java Plug-in then the user will be told this and a link to the latest Java Plug-in will be provided.
Sample2
and it and its supporting
classes are NOT archived within a jar file.
applet
tag)
<!-- Compatible with all browsers --> <applet code="Sample2" height="300" width="550" > </applet>
object
tag)
<!--[if !IE]> Firefox and others will use outer object --> <object classid="java:Sample2.class" type="application/x-java-applet" height="300" width="550" > <!--<![endif]--> <!-- MSIE (Microsoft Internet Explorer) will use inner object --> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab" height="300" width="550" > <param name="code" value="Sample2" /> <strong> This browser does not have a Java Plug-in. <br /> <a href="http://java.sun.com/products/plugin/downloads/index.html"> Get the latest Java Plug-in here. </a> </strong> </object> <!--[if !IE]> close outer object --> </object> <!--<![endif]-->
Sample2
and it and its supporting
classes are archived within a jar file
named Sample2.jar
.
applet
tag)
<!-- Compatible with all browsers --> <applet code="Sample2" archive="Sample2.jar" height="300" width="550" > </applet>
object
tag)
<!--[if !IE]> Firefox and others will use outer object --> <object classid="java:Sample2.class" type="application/x-java-applet" archive="Sample2.jar" height="300" width="550" > <!-- Konqueror browser needs the following param --> <param name="archive" value="Sample2.jar" /> <!--<![endif]--> <!-- MSIE (Microsoft Internet Explorer) will use inner object --> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab" height="300" width="550" > <param name="code" value="Sample2" /> <param name="archive" value="Sample2.jar" /> <strong> This browser does not have a Java Plug-in. <br /> <a href="http://java.sun.com/products/plugin/downloads/index.html"> Get the latest Java Plug-in here. </a> </strong> </object> <!--[if !IE]> close outer object --> </object> <!--<![endif]-->