• Java Applet Parameter

    Java Applet Parameter

    In The Topic Java Applet Parameter, programmer can pass  parameters to applet. To do this, use PARAM attribute of the APPLET tab, with setting the parameter’s name and value. To get back a parameter value, use the getParameter() method, defined by Applet. Its general form is shown here:

    String getParameter(String paramName);

    Here, paramName is the name of parameter. It pass the value of the specified parameter in the form of a String object.

    For Example,

    Java File



    CODE = HelloJavaParam.class

    WIDTH = 400

    HEIGHT = 200


    <PARAM NAME = “string” VALUE = “Applet! “>



    import java.awt.*;

    import java.applet.*;

    public class  HelloJavaParam extends Applet


    String str;

    public void init()


    str = getParameter(“string”);

    if(str == null)

    str = “Java”;

    str = “Hello ” + str;


    public void paint(Graphics g)


    g.drawString(str, 10, 100);



    HTML File



    <TITLE>Applet Parameter</TITLE>




    CODE = “HelloJavaParam.class”

    WIDTH = “400”

    HEIGHT = “200”


    <PARAM NAME = “string” VALUE = “Applet! “>





    Java Applet Parameter Example

    Figure: Java Applet Parameter Example

    Appreciate my work :Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on RedditShare on StumbleUponShare on TumblrDigg thisShare on YummlyShare on VKFlattr the authorBuffer this page

Leave a Reply

Your email address will not be published. Required fields are marked *