import java.applet.Applet;
import java.awt.*;

public class scrolltext extends Applet {

  Image osi=null;
  Graphics osg=null;
  int a=200;
  int t=0;
  String[] messages={"Hello Chun Wing!",
                     "How's it going?",
                     "Did you do well on the physics test?",
                     "Did you do the chem lab report?",
                     "Learn JavaScript, it's fun!",
                     "Or Java, which is much more useful.",
                     "And much easier, too (according to me).",
                     "NOOO!!! I won't optimize your POINTS!",
                     "I hope this is what you wanted...",
                     "See you tomorrow!"};

  public void init() {
    setBackground(Color.white);
    osi=createImage(500, messages.length*50);
    osg=osi.getGraphics();
    for (int q=0; q<messages.length; q++)
      osg.drawString(messages[q], 5, 50*q+25);
  }

  public void update(Graphics g) {
    paint(g);
  }

  public void paint(Graphics g) {
    g.drawImage(osi, 0, a, null);
    a--;
    if (t==65) {
      t=0;
      a--;
    }
    if (a<-50*messages.length)
      a=200;
    if (-a%50==0 && a<50 && t<65) {
      a++;
      t++;
      skip(10);
    }
    skip(20);
  }

  public void skip(int v) {
    try {
      Thread.sleep(v);
    } catch (InterruptedException e) {
      showStatus(e.toString());
    }
    repaint();
  }
}