Sunday, 8 September 2013

java applet displaying name

import java.awt.Graphics;
 import java.awt.Font;
 import java.awt.Color;

 public class MoreHelloApplet extends java.applet.Applet {

 Font f = new Font("TimesRoman",Font.BOLD,36);
 String name;

 public void init() {
 this.name = getParameter("name");
 if (this.name == null)
this.name = "Sateesh Bagadhi";

 this.name = "Hello  " + this.name + "!";
    }

 public void paint(Graphics g) {
 g.setFont(f);
 g.setColor(Color.red);
 g.drawString(this.name, 5, 50);
 }
 }