Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;

public class Main extends Applet {
    private String name = "";

    public void init() {
        name = getParameter("name");
    }

    public void paint(Graphics g) {
        g.setColor(Color.BLUE);
        g.drawString(name, 0, 0);
    }
}

To enable
the web
browser to
execute the
applet create
the following
html page.

<html><head><title>Parameterized Applet</title></head><body><
applet code = "Main"height="150"width="350"><param name="name"value="abc"/></applet></body></html>