home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class ZingBars extends Applet implements Runnable {
- int direction;
- float xpos;
- float ypos;
- int curr_dir;
- // $FF: renamed from: dx int
- int field_0;
- // $FF: renamed from: dy int
- int field_1;
- // $FF: renamed from: x1 float
- float field_2;
- // $FF: renamed from: y1 float
- float field_3;
- // $FF: renamed from: x2 float
- float field_4;
- // $FF: renamed from: y2 float
- float field_5;
- int realLength;
- int realHeight;
- int col_select;
- int width = 400;
- int height = 40;
- float velocity = 5.0F;
- int fontstyle;
- boolean suspended = false;
- int bar_width = 10;
- Color color;
- Color forecolour;
- Color backcolour;
- Thread killme;
- Image barimage;
- int interval = 10;
- Image offscreen;
- Graphics barGraphics;
- Graphics offscreenG;
-
- public void init() {
- String var1 = ((Applet)this).getParameter("direction");
- this.direction = var1 != null ? Integer.parseInt(var1) : 0;
- var1 = ((Applet)this).getParameter("barwidth");
- this.bar_width = var1 != null ? Integer.parseInt(var1) : 10;
- var1 = ((Applet)this).getParameter("copyright");
- if (var1 == null) {
- System.exit(1);
- } else if (var1.compareTo("LiquidFx") > 0) {
- System.exit(1);
- }
-
- var1 = ((Applet)this).getParameter("width");
- this.width = var1 != null ? Integer.parseInt(var1) : 400;
- var1 = ((Applet)this).getParameter("height");
- this.height = var1 != null ? Integer.parseInt(var1) : 40;
- var1 = ((Applet)this).getParameter("colselect");
- this.col_select = var1 != null ? Integer.parseInt(var1) : 0;
- if (this.col_select > 6) {
- this.col_select = 6;
- }
-
- var1 = ((Applet)this).getParameter("velocity");
- this.velocity = (float)(var1 != null ? Integer.parseInt(var1) : 1);
- this.interval = 20;
- this.velocity /= (float)(1000 / this.interval);
- var1 = ((Applet)this).getParameter("forecolour");
- int var2 = var1 != null ? Integer.parseInt(var1) : 255;
- int var3 = var2 & 255;
- int var4 = (var2 & '\uff00') >> 8;
- int var5 = (var2 & 16711680) >>> 16;
- this.forecolour = new Color(221, 0, 0);
- var1 = ((Applet)this).getParameter("backcolour");
- var2 = var1 != null ? Integer.parseInt(var1) : 255;
- var3 = var2 & 255;
- var4 = (var2 & '\uff00') >> 8;
- var5 = (var2 & 16711680) >>> 16;
- this.backcolour = new Color(var3, var4, var5);
- if (this.direction == 1) {
- this.field_0 = ((Component)this).size().width;
- this.field_1 = this.bar_width;
- } else {
- this.field_1 = ((Component)this).size().height;
- this.field_0 = this.bar_width;
- }
-
- this.barimage = ((Component)this).createImage(this.field_0, this.field_1);
- this.barGraphics = this.barimage.getGraphics();
- this.paint_bar(this.barGraphics);
- this.offscreen = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.offscreenG = this.offscreen.getGraphics();
- }
-
- public void paint(Graphics var1) {
- this.update(var1);
- }
-
- public void start() {
- if (this.killme == null) {
- this.killme = new Thread(this);
- this.killme.start();
- }
-
- }
-
- public void setcoord() {
- if (this.direction == 1) {
- this.field_2 = 0.0F;
- this.field_4 = (float)this.width;
- this.field_3 = this.ypos;
- this.field_5 = this.ypos;
- if (this.curr_dir == 0) {
- this.ypos += this.velocity;
- if (this.ypos + (float)this.bar_width >= (float)this.height) {
- this.curr_dir = 1;
- this.ypos = (float)(this.height - this.bar_width);
- return;
- }
-
- return;
- }
-
- this.ypos -= this.velocity;
- if (this.ypos <= 0.0F) {
- this.curr_dir = 0;
- this.ypos = 0.0F;
- return;
- }
- } else {
- this.field_3 = 0.0F;
- this.field_5 = (float)this.height;
- this.field_2 = this.xpos;
- this.field_4 = this.xpos;
- if (this.curr_dir == 0) {
- this.xpos += this.velocity;
- if (this.xpos + (float)this.bar_width >= (float)this.width) {
- this.curr_dir = 1;
- this.xpos = (float)(this.width - this.bar_width);
- return;
- }
- } else {
- this.xpos -= this.velocity;
- if (this.xpos <= 0.0F) {
- this.curr_dir = 0;
- this.xpos = 0.0F;
- }
- }
- }
-
- }
-
- public void run() {
- while(this.killme != null) {
- try {
- Thread.sleep((long)this.interval);
- } catch (InterruptedException var2) {
- }
-
- this.setcoord();
- Graphics var1 = ((Component)this).getGraphics();
- this.paint(var1);
- ((Component)this).repaint();
- }
-
- }
-
- public synchronized void update(Graphics var1) {
- this.offscreenG.setColor(this.backcolour);
- this.offscreenG.fillRect(0, 0, this.width, this.height);
- this.offscreenG.drawImage(this.barimage, (int)this.field_2, (int)this.field_3, this);
- var1.drawImage(this.offscreen, 0, 0, this);
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 501) {
- if (this.suspended) {
- this.killme.resume();
- } else {
- this.killme.suspend();
- }
-
- this.suspended = !this.suspended;
- }
-
- return true;
- }
-
- public void stop() {
- if (this.killme != null) {
- this.killme.stop();
- }
-
- this.killme = null;
- }
-
- public void paint_bar(Graphics var1) {
- byte var2 = 100;
- float var4 = (float)(255 - var2) / (float)this.bar_width;
- int var5 = 0;
- int var6 = 0;
- int var7 = 0;
- if (this.direction == 1) {
- var1.setColor(this.backcolour);
- var1.drawLine(0, 0, this.width, 0);
- var1.setColor(this.backcolour);
- var1.drawLine(0, this.bar_width - 1, this.width, this.bar_width - 1);
-
- for(int var9 = 1; var9 < this.bar_width / 2; ++var9) {
- switch (this.col_select) {
- case 0:
- var5 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 1:
- var6 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 2:
- var7 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 3:
- var5 = (int)((float)var2 + (float)var9 * var4);
- var6 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 4:
- var7 = (int)((float)var2 + (float)var9 * var4);
- var6 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 5:
- var7 = (int)((float)var2 + (float)var9 * var4);
- var5 = (int)((float)var2 + (float)var9 * var4);
- break;
- case 6:
- var5 = (int)((float)var2 + (float)var9 * var4);
- var6 = (int)((float)var2 + (float)var9 * var4);
- var7 = (int)((float)var2 + (float)var9 * var4);
- }
-
- this.color = new Color(var5, var6, var7);
- var1.setColor(this.color);
- var1.drawLine(0, var9, this.width, var9);
- }
-
- for(int var10 = this.bar_width / 2; var10 < this.bar_width - 1; ++var10) {
- switch (this.col_select) {
- case 0:
- var5 = (int)(255.0F - (float)var10 * var4);
- break;
- case 1:
- var6 = (int)(255.0F - (float)var10 * var4);
- break;
- case 2:
- var7 = (int)(255.0F - (float)var10 * var4);
- break;
- case 3:
- var5 = (int)(255.0F - (float)var10 * var4);
- var6 = (int)(255.0F - (float)var10 * var4);
- break;
- case 4:
- var7 = (int)(255.0F - (float)var10 * var4);
- var6 = (int)(255.0F - (float)var10 * var4);
- break;
- case 5:
- var7 = (int)(255.0F - (float)var10 * var4);
- var5 = (int)(255.0F - (float)var10 * var4);
- break;
- case 6:
- var5 = (int)(255.0F - (float)var10 * var4);
- var6 = (int)(255.0F - (float)var10 * var4);
- var7 = (int)(255.0F - (float)var10 * var4);
- }
-
- this.color = new Color(var5, var6, var7);
- var1.setColor(this.color);
- var1.drawLine(0, var10, this.width, var10);
- }
-
- } else {
- var1.setColor(this.backcolour);
- var1.drawLine(0, 0, 0, this.height);
- var1.setColor(this.backcolour);
- var1.drawLine(this.bar_width - 1, 0, this.bar_width - 1, this.height);
-
- for(int var3 = 1; var3 < this.bar_width - 1; ++var3) {
- switch (this.col_select) {
- case 0:
- var5 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 1:
- var6 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 2:
- var7 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 3:
- var5 = (int)((float)var2 + (float)var3 * var4);
- var6 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 4:
- var7 = (int)((float)var2 + (float)var3 * var4);
- var6 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 5:
- var7 = (int)((float)var2 + (float)var3 * var4);
- var5 = (int)((float)var2 + (float)var3 * var4);
- break;
- case 6:
- var5 = (int)((float)var2 + (float)var3 * var4);
- var6 = (int)((float)var2 + (float)var3 * var4);
- var7 = (int)((float)var2 + (float)var3 * var4);
- }
-
- this.color = new Color(var5, var6, var7);
- var1.setColor(this.color);
- var1.drawLine(var3, 0, var3, this.height);
- }
-
- for(int var8 = this.bar_width / 2; var8 < this.bar_width - 1; ++var8) {
- switch (this.col_select) {
- case 0:
- var5 = (int)(255.0F - (float)var8 * var4);
- break;
- case 1:
- var6 = (int)(255.0F - (float)var8 * var4);
- break;
- case 2:
- var7 = (int)(255.0F - (float)var8 * var4);
- break;
- case 3:
- var5 = (int)(255.0F - (float)var8 * var4);
- var6 = (int)(255.0F - (float)var8 * var4);
- break;
- case 4:
- var7 = (int)(255.0F - (float)var8 * var4);
- var6 = (int)(255.0F - (float)var8 * var4);
- break;
- case 5:
- var7 = (int)(255.0F - (float)var8 * var4);
- var5 = (int)(255.0F - (float)var8 * var4);
- break;
- case 6:
- var5 = (int)(255.0F - (float)var8 * var4);
- var6 = (int)(255.0F - (float)var8 * var4);
- var7 = (int)(255.0F - (float)var8 * var4);
- }
-
- this.color = new Color(var5, var6, var7);
- var1.setColor(this.color);
- var1.drawLine(var8, 0, var8, this.height);
- }
-
- }
- }
- }
-