All for Joomla All for Webmasters

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>
PinIt
submit to reddit

Leave a Reply

Top