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:
S
Shyam Dubey     View Profile
I am a good learner. I like posting new questions on this plateform to help other students.