Search Your Topic

config
Thursday, 25 May 2017 06:28

Parameter in Applet

Written by
Rate this item
(0 votes)

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.   
  4. public class UseParam extends Applet{  
  5.   
  6. public void paint(Graphics g){  
  7. String str=getParameter("msg");  
  8. g.drawString(str,5050);  
  9. }  
  10.   
  11. }  

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>  
Read 305 times
Anish Sir

"I am delighted once again to pen the welcome note to the Tosh!Yas Technologies ."

 Call +91 74 88 34 7779  | Email : anishsingh@live.com

toshiyas.in

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Facebook