FileDocCategorySizeDatePackage
NervousText.javaAPI DocExample3241Sat Sep 12 03:01:00 BST 1998None

NervousText

public class NervousText extends Applet implements Runnable

Fields Summary
char[]
separated
String
s
Thread
killme
int
i
int
x_coord
int
y_coord
String
num
int
speed
int
counter
boolean
threadSuspended
Constructors Summary
Methods Summary
public voidinit()

 //added by kwalrath

   
	s = getParameter("text");
	if (s == null) {
	    s = "HotJava";
	}

	separated =  new char [s.length()];
	s.getChars(0,s.length(),separated,0);
	resize((s.length()+1)*15, 50);
	setFont(new Font("TimesRoman",Font.BOLD,36));
 
public booleanmouseDown(java.awt.Event evt, int x, int y)

        if (threadSuspended) {
            killme.resume();
        }
        else {
            killme.suspend();
        }
        threadSuspended = !threadSuspended;
    return true;
    
public voidpaint(java.awt.Graphics g)

	for(i=0;i<s.length();i++)
	{
	x_coord = (int) (Math.random()*10+15*i);
	y_coord = (int) (Math.random()*10+36);
	g.drawChars(separated, i,1,x_coord,y_coord);
	}
 
public voidrun()

	while (killme != null) {
	try {Thread.sleep(100);} catch (InterruptedException e){}
	repaint();
	}
	killme = null;
 
public voidstart()

	if(killme == null) 
	{
        killme = new Thread(this);
        killme.start();
	}
 
public voidstop()

	killme = null;