Parameter in Applet

Parameter in Applet

We can get any information from the HTML file as a parameter. For this purpose, Applet class provides a method named getParameter(). Syntax:

  1. public String getParameter(String parameterName)

Example of using parameter in Applet:

 

  1. import java.applet.Applet;
  2. import java.awt.Graphics;
  3. public class UseParam extends Applet{
  4. public void paint(Graphics g){
  5. String str=getParameter(“msg”);
  6. g.drawString(str,5050);
  7. }
  8. }

myapplet.html

  1. <html>
  2. <body>
  3. <applet code=“UseParam.class” width=“300” height=“300”>
  4. <param name=“msg” value=“Welcome to applet”>
  5. </applet>
  6. </body>
  7. </html>
download this example.
Next TopicApplet Communication
java for beginners
java for beginners
java for beginners
CodSir //course // books
...

WikiSir

Parameter in Applet We can get any information from the HTML file as a parameter. For this purpose, Applet class provides a method named getParameter(). Syntax: public String getParameter(String parameterName) Example of using parameter in Applet:   import java.applet.Applet; import java.awt.Graphics; public class UseParam extends Applet{ public void paint(Graphics g){ String str=getParameter(“msg”); g.drawString(str,50, 50); } } myapplet.html <html> <body> <applet code=“UseParam.class” width=“300” height=“300”> <param name=“msg” value=“Welcome to applet”> </applet> </body> </html> download this example. Next TopicApplet […]

Tags:

....
...