Java HTML/Applet Interface

HTML/Applet Interface
The HTML applet tag is similar to the HTML img tag, and has the form:

[parameters]

where the optional parameters are a list of parameter definitions of the form:

An example tag with parameter definitions is:




where p1 and p2 are user-defined parameters.
The code, width, and height parameters are mandatory. The parameters codebase, alt, archives, align, vspace, and hspace are optional within the tag itself. Your applet can access any of these parameters by calling:
Applet.getParameter("p")
which returns the String value of the parameter. For example, the applet:
import java.applet.Applet;
public class ParamTest extends Applet {
public void init() {
System.out.println("width is " + getParameter("width"));
System.out.println("p1 is " + getParameter("p1"));
System.out.println("p2 is " + getParameter("p2"));
}
}
prints the following to standard output:
width is 300
p1 is 34
p2 is test

  © Free Blogger Templates Modic Template by For more Information : click Here

Back to TOP