You are here: Home / Topics / Program to create Applet with param tag in Java

Program to create Applet with param tag in Java

Filed under: Java on 2023-09-20 06:40:46

// Program to create Applet with param tag.

import java.awt.*;
import java.applet.Applet;

/*
<applet code="AppletTest2b.class" width="300" height="100">
<param name="message" value="BIIT Computer Education" />
</applet>
*/

public class  AppletTest2b  extends  Applet 
{
String msg = "";

public void init() 
{
 setBackground( Color.yellow );
 msg = getParameter("message");
}

public void paint( Graphics g ) 
{
 g.drawString( msg, 50, 50 );
 System.out.println(msg);
}
}


Output:

 D:\Java>appletviewer AppletTest2b.java

About Author:
M
Mr. Dubey     View Profile
Founder and CEO of MCQ Buddy. I just like to help others.