home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 June / INTERNET92.ISO / pc / software / windows / building / visual_dhtml / visualdhtmlwin2000.exe / dvstime1.___ (.txt) < prev    next >
Encoding:
Java Class File  |  2001-10-19  |  1.4 KB  |  62 lines

  1. import java.applet.Applet;
  2. import java.awt.Event;
  3. import netscape.javascript.JSObject;
  4.  
  5. public class dvstimer extends Applet implements Runnable {
  6.    Thread animator;
  7.    JSObject script;
  8.    boolean scrollit;
  9.    spart test;
  10.    public int delaytime = -1;
  11.  
  12.    public void start() {
  13.       if (this.animator == null) {
  14.          this.scrollit = true;
  15.          this.animator = new Thread(this);
  16.          this.animator.start();
  17.       }
  18.  
  19.    }
  20.  
  21.    public void stop() {
  22.       if (this.animator != null) {
  23.          this.scrollit = false;
  24.          this.animator.stop();
  25.          this.animator = null;
  26.       }
  27.  
  28.    }
  29.  
  30.    public boolean mouseDown(Event var1, int var2, int var3) {
  31.       this.animator.suspend();
  32.       return true;
  33.    }
  34.  
  35.    public boolean mouseUp(Event var1, int var2, int var3) {
  36.       this.animator.resume();
  37.       return true;
  38.    }
  39.  
  40.    public void run() {
  41.       while(this.scrollit) {
  42.          this.script.call("scrollIt", (Object[])null);
  43.  
  44.          try {
  45.             Thread.sleep((long)this.delaytime);
  46.          } catch (InterruptedException var2) {
  47.          }
  48.       }
  49.  
  50.    }
  51.  
  52.    public void init() {
  53.       this.delaytime = Integer.parseInt(((Applet)this).getParameter("delay"));
  54.       this.script = JSObject.getWindow(this);
  55.       this.scrollit = true;
  56.    }
  57.  
  58.    public void stopscroll() {
  59.       this.scrollit = false;
  60.    }
  61. }
  62.