home *** CD-ROM | disk | FTP | other *** search
/ Datatid 2000 #1 / Datatid-2000-01.iso / Internet / SPLASH / SPLASH12.EXE / data1.cab / Plugins / _Text / Tiny_Scroll / tinyScroller.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-12-18  |  4.0 KB  |  210 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Image;
  7. import java.awt.image.ImageObserver;
  8.  
  9. public class tinyScroller extends Applet implements Runnable {
  10.    int maxLines = 100;
  11.    int direction;
  12.    int delay = 100;
  13.    int startDelay;
  14.    int spacing = 12;
  15.    int XPos = 5;
  16.    int maxLine;
  17.    int current;
  18.    int height;
  19.    String[] Line;
  20.    Image offImage;
  21.    // $FF: renamed from: bg java.awt.Image
  22.    Image field_0;
  23.    Graphics offGrfx;
  24.    Font outFont;
  25.    boolean customFont;
  26.    Color background;
  27.    Color fontColor;
  28.    Thread runner;
  29.  
  30.    public void init() {
  31.       String var1 = ((Applet)this).getParameter("BGRED");
  32.       String var2 = ((Applet)this).getParameter("BGGREEN");
  33.       String var3 = ((Applet)this).getParameter("BGBLUE");
  34.       String var4 = ((Applet)this).getParameter("FGRED");
  35.       String var5 = ((Applet)this).getParameter("FGGREEN");
  36.       String var6 = ((Applet)this).getParameter("FGBLUE");
  37.       String var7 = ((Applet)this).getParameter("SPACING");
  38.       String var8 = ((Applet)this).getParameter("DELAY");
  39.       String var9 = ((Applet)this).getParameter("STARTDELAY");
  40.       String var10 = ((Applet)this).getParameter("XPOS");
  41.       ((Applet)this).getParameter("MAXLINE");
  42.       String var11 = ((Applet)this).getParameter("BACKGROUND");
  43.       String var12 = ((Applet)this).getParameter("FONTNAME");
  44.       String var13 = ((Applet)this).getParameter("FONTSIZE");
  45.       String var14 = ((Applet)this).getParameter("DIRECTION");
  46.  
  47.       for(int var15 = 0; var15 < this.maxLines; ++var15) {
  48.          this.Line[var15] = ((Applet)this).getParameter("LINE" + Integer.toString(var15 + 1));
  49.       }
  50.  
  51.       if (var13 != null && var12 != null) {
  52.          int var16 = Integer.parseInt(var13);
  53.          this.outFont = new Font(var12, 0, var16);
  54.          this.customFont = true;
  55.       }
  56.  
  57.       for(int var23 = 0; var23 < this.maxLines && this.Line[var23] != null; ++var23) {
  58.          ++this.maxLine;
  59.       }
  60.  
  61.       int var17 = 255;
  62.       if (var1 != null) {
  63.          var17 = Integer.parseInt(var1);
  64.       }
  65.  
  66.       int var18 = 255;
  67.       if (var2 != null) {
  68.          var18 = Integer.parseInt(var2);
  69.       }
  70.  
  71.       int var19 = 255;
  72.       if (var3 != null) {
  73.          var19 = Integer.parseInt(var3);
  74.       }
  75.  
  76.       int var20 = 0;
  77.       if (var4 != null) {
  78.          var20 = Integer.parseInt(var4);
  79.       }
  80.  
  81.       int var21 = 0;
  82.       if (var5 != null) {
  83.          var21 = Integer.parseInt(var5);
  84.       }
  85.  
  86.       int var22 = 0;
  87.       if (var6 != null) {
  88.          var22 = Integer.parseInt(var6);
  89.       }
  90.  
  91.       if (var7 != null) {
  92.          this.spacing = Integer.parseInt(var7);
  93.       }
  94.  
  95.       if (var8 != null) {
  96.          this.delay = Integer.parseInt(var8);
  97.       }
  98.  
  99.       if (var9 != null) {
  100.          this.startDelay = Integer.parseInt(var9);
  101.       }
  102.  
  103.       if (var10 != null) {
  104.          this.XPos = Integer.parseInt(var10);
  105.       }
  106.  
  107.       this.height = ((Component)this).size().height;
  108.       if (var14 != null) {
  109.          this.direction = Integer.parseInt(var14);
  110.       }
  111.  
  112.       if (var11 != null) {
  113.          this.field_0 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), var11);
  114.       }
  115.  
  116.       if (this.direction == 0) {
  117.          this.current = this.height;
  118.       } else {
  119.          this.current = -(this.maxLine * this.spacing);
  120.       }
  121.  
  122.       this.fontColor = new Color(var20, var21, var22);
  123.       this.background = new Color(var17, var18, var19);
  124.       ((Component)this).setBackground(this.background);
  125.       this.offImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  126.       this.offGrfx = this.offImage.getGraphics();
  127.    }
  128.  
  129.    public void paint(Graphics var1) {
  130.       this.offGrfx.setColor(this.background);
  131.       this.offGrfx.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  132.       if (this.field_0 != null) {
  133.          this.offGrfx.drawImage(this.field_0, 0, this.current - this.height, (ImageObserver)null);
  134.       }
  135.  
  136.       this.offGrfx.setColor(this.fontColor);
  137.  
  138.       try {
  139.          this.offGrfx.setFont(this.outFont);
  140.       } catch (NullPointerException var3) {
  141.       }
  142.  
  143.       if (this.direction == 0) {
  144.          for(int var2 = 0; var2 < this.maxLine; ++var2) {
  145.             this.offGrfx.drawString(this.Line[var2], this.XPos, this.current + var2 * this.spacing);
  146.          }
  147.       } else {
  148.          for(int var4 = 0; var4 < this.maxLine; ++var4) {
  149.             this.offGrfx.drawString(this.Line[var4], this.XPos, this.current + (this.maxLine - var4) * this.spacing);
  150.          }
  151.       }
  152.  
  153.       var1.drawImage(this.offImage, 0, 0, this);
  154.    }
  155.  
  156.    public void update(Graphics var1) {
  157.       this.paint(var1);
  158.    }
  159.  
  160.    public void start() {
  161.       if (this.runner == null) {
  162.          this.runner = new Thread(this);
  163.          this.runner.start();
  164.       }
  165.  
  166.    }
  167.  
  168.    public void run() {
  169.       ((Component)this).repaint();
  170.  
  171.       try {
  172.          Thread.sleep((long)this.startDelay);
  173.       } catch (InterruptedException var2) {
  174.       }
  175.  
  176.       while(true) {
  177.          ((Component)this).repaint();
  178.          if (this.direction == 0) {
  179.             --this.current;
  180.             if (this.current + this.maxLine * this.spacing < 0) {
  181.                this.current = this.height + this.spacing;
  182.             }
  183.          } else {
  184.             ++this.current;
  185.             if (this.current > this.height) {
  186.                this.current = -(this.maxLine * this.spacing);
  187.             }
  188.          }
  189.  
  190.          try {
  191.             Thread.sleep((long)this.delay);
  192.          } catch (InterruptedException var1) {
  193.          }
  194.       }
  195.    }
  196.  
  197.    public void stop() {
  198.       if (this.runner != null) {
  199.          this.runner.stop();
  200.          this.runner = null;
  201.       }
  202.  
  203.    }
  204.  
  205.    public tinyScroller() {
  206.       this.Line = new String[this.maxLines];
  207.       this.customFont = false;
  208.    }
  209. }
  210.