Showing posts with label Parameter in Applet. Show all posts
Showing posts with label Parameter in Applet. Show all posts

Thursday, 12 March 2015

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:
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,5050);  
}  
  
}  

myapplet.html

<html>  
<body>  
<applet code="UseParam.class" width="300" height="300">  
<param name="msg" value="Welcome to applet">  
</applet>  
</body>  
</html>