How to Pass parameters to Applet

https://www.computersprofessor.com/2016/12/how-to-pass-parameters-to-applet.html
Passing parameters to
Applet:
We can supply
user – defined parameters to an
applet using <
PARAM---------> tags. Each < PARAM --- > tag has a name
attribute such as color,
and a value attributes such
as red . Inside the
applet code the applet can refer to
the parameter by name
to find its value. for example
we can change the color of
the text displayed
to red by an
applet by using
a < PARAM ---- > tag as
follows:
< PARAM NAME
=" colour" value =" red ">
< / APPLET >
Similarly we can change
the text to be
displayed an applet by
supplying new text
to the applet
through a < PARAM---- > tag
as follows.
< PARAM NAME=" text" value = “I
LIKE JAVA” >
passing parameter to
an applet code using
< PARAM > tag is something
slimier to passing
parameter to the
main ( )
method using command
is arguments. To set
up is handle
parameters is need
to do two
thing.
1.
Include
appropriate < PARAM >
tags in the
HTML documents.
2.
Provide
code in the
applet to parse
these parameters.
Parameters are
passed on an applet When it
is loaded. we
can define the init
( )
Method in the
applet to get
hold of the parameter defined in the
tags.
This is
done using the
parameters which takes
one string arguments
representing
the name of
the parameter and runs a
string containing the value
of that parameter.
Ex:
import java .awt.*;
import java. applet. * ;
public class HelloJavaParam extends
Applet
{
String
str ;
public
void init ( )
{
str =getParameter (“ string”)
; // Receiving
parameter value
if (str = = null)
str =
“Java”;
str
= “ Hello” + str ; // using the
value.
}
public
void paint (Graphics
g)
{
g.
draw string ( str,10,100)
}
}
The HTML file
for HelloJavaParam Applet:
< HTML >
< ! parameterized
HTML file >
<
HEAD >