NervousTextpublic 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 |
Methods Summary |
---|
public void | init() //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 boolean | mouseDown(java.awt.Event evt, int x, int y)
if (threadSuspended) {
killme.resume();
}
else {
killme.suspend();
}
threadSuspended = !threadSuspended;
return true;
| public void | paint(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 void | run()
while (killme != null) {
try {Thread.sleep(100);} catch (InterruptedException e){}
repaint();
}
killme = null;
| public void | start()
if(killme == null)
{
killme = new Thread(this);
killme.start();
}
| public void | stop()
killme = null;
|
|