ALT= "Applet could not be loaded" Sorry, it is time to upgrade your browser to a Java powered one.


SOURCE CODE

// Applet that displays a simple logo on the screen

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

public class logo extends java.applet.Applet{
    // Declare the object variable array StrLine with 3 values.
    String StrLine[] = new String[1];

    //Delcare the Font object called appFont.
    Font appFont;

    public void init() {
        // Get the value for the 
        String att = getParameter("Text");
        StrLine[0] = (att == null) ? "Please Enter Something in the parameter Text!" : att;

        //Construct the font with the following attributes:
        //                 Font       attrib     Size
        appFont = new Font("Helvetica", Font.BOLD, 28);

    }
    
public void paint(Graphics g) {
        //Create an instance of the object FontMetrics called fm.
        FontMetrics fm;

        // Set the fonts metrics for the object g
        fm = g.getFontMetrics(appFont);

        // Create an instance of the object Rectangle and give it
        // the specs for the applet.
        Rectangle r = bounds();

        // Change the color of the graphics printed to red.
        g.setColor(Color.red);

        //Set the Font for object g
        g.setFont(appFont);

        // Display the variable on the screen with a dynamic setting
        // to ensure that it is centered on the applet.
        g.drawString(StrLine[0],  (r.width - fm.stringWidth(StrLine[0])) / 2,
 (r.height - fm.getHeight()) /2);             
    }    

}