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


SOURCE CODE

// aniLogo version 2.0 rev 2

import java.awt.*;

public class anilogo extends java.applet.Applet implements Runnable {
    Rectangle r;
    // Declare the object variable array StrLine with 3 values.
    String StrLine[] = new String[3];

    Font appFont;

    // Create a Thread object called myThread
    Thread myThread = null;

    // declare width array
    int width[] = new int[3];

    public void init() {

        // A for loop to find the three lines of text.
        for (int i = 0; i < 3; i++) {
            String att = getParameter("Text" + i);
            StrLine[i] = (att == null) ? ("Please put a parameter in Text" + i) : att;


        }

        appFont = new Font("Helvetica", Font.BOLD, 28);
        r = bounds(); 

    }

    // Overide this method from the interface Runnable
    public void run() {
        //Set the current Threads priority.    
       Thread.currentThread().setPriority(Thread.NORM_PRIORITY - 1);

        // Initalize the locations of the two lines of text to be
        // of the screen.
        width[1] = 2000;
        width[2] = 2000;
        // Repaint the entire screen
        repaint();
        
        // Algorithm to send the first line of Text across the screen.
        for ( int i = - 50; i < r.width/2; i += 7) {
            width[0] = i;
            // repaint the entire screen since this is the first line
            // of text currently being drawn.
            repaint();
            // Rest 
            Rest(1);
        }

        // Algorithm to send the second line of text across the screen.
        for (int i = r.width + 20; i > r.width/2; i -= 7) {
            width[1] = i;
            // repaint only part of the screen where line two resides
            repaint(0, 30, r.width, 35);
            Rest(1);
        }

        //Algorithm to send the third line of text across the screen
        for ( int i = - 90; i < r.width/2; i += 7) {
            width[2] = i;
            // repaint only part of the screen where line three resides
            repaint(0, 60, r.width, 30);
            // Rest 
            Rest(1);
        }

    }

    void Rest(int r) {
        //Rest for a period of time
        try {
            myThread.sleep(100 * r);
        } catch (InterruptedException e) {
            return;
        }
    }


    public void start() {
        if (myThread == null) {
            myThread = new Thread(this);
            myThread.start();
        }
    }

    public void stop() {
        if (myThread != null) {
            myThread.stop();
            myThread = null;
        }
    }


    public void paint(Graphics g) {
        g.setColor(Color.red);

        g.setFont(appFont);

        for (int i = 0; i < 3; i++) {
            g.drawString(StrLine[i],  width[i] + (10 * i), 30 + (25 * i));
        }
    }

}