home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class warp extends Applet implements Runnable {
- // $FF: renamed from: s java.lang.String
- private String field_0;
- private int stringLength;
- private Thread engineThread;
- private boolean userPause;
- private boolean readyToPaint = true;
- private int x_coord = 2;
- private int y_coord = 2;
- private String speed;
- private boolean threadSuspended;
- private boolean debug;
- private String fontstring;
- private int fontsize = 20;
- private int newFontSize = 20;
- private int fontstyle;
- private int changeSize = 1;
- private int focalSize = 1;
- private int sleepTime;
- private Color stringColor;
- private Color backColor;
- private Image offImage;
- private Graphics offGraphics;
- private Dimension offScrSize;
- private Font font;
- private boolean matched;
- private boolean unreg = true;
- private boolean toSmall = true;
-
- public void stop() {
- if (this.engineThread != null && this.engineThread.isAlive()) {
- this.engineThread.stop();
- }
-
- this.engineThread = null;
- }
-
- private synchronized void updateFont() {
- this.font = new Font(this.fontstring, this.fontstyle, this.newFontSize);
- }
-
- public synchronized void prePaint(Graphics var1) {
- var1.setColor(this.backColor);
- var1.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
- var1.setFont(this.font);
- var1.setColor(this.stringColor);
- this.centerString(var1);
- if (this.debug) {
- System.out.println(this.newFontSize);
- }
-
- var1.drawString(this.field_0, this.x_coord, this.y_coord);
- this.newFontSize = this.toSmall ? this.newFontSize - this.changeSize : this.newFontSize + this.changeSize;
- if (this.newFontSize == 27) {
- this.newFontSize = this.toSmall ? this.newFontSize - this.changeSize : this.newFontSize + this.changeSize;
- }
-
- if (this.newFontSize <= this.focalSize) {
- this.toSmall = false;
- this.newFontSize = this.focalSize;
- } else if (this.newFontSize >= this.fontsize) {
- this.toSmall = true;
- }
-
- }
-
- public void paint(Graphics var1) {
- if (this.engineThread != null) {
- if (this.offGraphics != null) {
- this.prePaint(this.offGraphics);
- var1.drawImage(this.offImage, 0, 0, this);
- } else {
- this.prePaint(var1);
- }
- }
-
- }
-
- private void dbg(String var1) {
- if (this.debug) {
- System.out.println(var1);
- }
-
- }
-
- public synchronized void update(Graphics var1) {
- Dimension var2 = ((Component)this).size();
- if (this.offImage == null || var2.width != this.offScrSize.width || var2.height != this.offScrSize.height) {
- this.offImage = ((Component)this).createImage(var2.width, var2.height);
- this.offGraphics = this.offImage.getGraphics();
- this.offGraphics.setFont(((Component)this).getFont());
- this.offScrSize = var2;
- }
-
- if (this.readyToPaint) {
- this.paint(var1);
- }
-
- }
-
- private synchronized void centerString(Graphics var1) {
- FontMetrics var2 = var1.getFontMetrics();
- if (var2 != null) {
- this.x_coord = ((Component)this).size().width / 2 - var2.stringWidth(this.field_0) / 2;
- this.y_coord = ((Component)this).size().height / 2 + var2.getAscent() / 2;
- }
-
- }
-
- public void start() {
- if (this.engineThread == null) {
- this.engineThread = new Thread(this);
- }
-
- this.engineThread.start();
- }
-
- public String getAppletInfo() {
- return "Swami - warp.class v1.0 Copyright (c) Sausage SoftWare 1996";
- }
-
- public void run() {
- Thread.currentThread().setPriority(1);
-
- while(true) {
- if (this.unreg) {
- ((Applet)this).getAppletContext().showStatus("Unregistered version. Copyright (c) Sausage Software 1996");
- }
-
- ((Component)this).repaint();
-
- try {
- Thread.sleep((long)this.sleepTime);
- } catch (Exception var1) {
- }
-
- this.readyToPaint = false;
- this.updateFont();
- this.readyToPaint = true;
- }
- }
-
- public void init() {
- String var1 = ((Applet)this).getParameter("font");
- this.fontstring = null;
- this.fontstring = myFont.getFontName(var1);
- this.dbg(this.fontstring);
- var1 = ((Applet)this).getParameter("fontsize");
- if (var1 != null) {
- this.fontsize = this.newFontSize = Integer.parseInt(var1);
- }
-
- var1 = ((Applet)this).getParameter("style");
- this.fontstyle = myFont.getFontStyle(var1);
- var1 = ((Applet)this).getParameter("focalSize");
- if (var1 != null) {
- this.focalSize = Integer.parseInt(var1);
- }
-
- this.field_0 = ((Applet)this).getParameter("text");
- if (this.field_0 == null) {
- this.field_0 = "Sausage Software";
- }
-
- this.stringLength = this.field_0.length();
- String var2 = ((Applet)this).getParameter("reguser");
- if (var2 == null) {
- ver.NotRegistered();
- }
-
- if (var2.toLowerCase().equals("unregistered")) {
- this.unreg = true;
- } else {
- this.unreg = false;
- }
-
- String var3 = ((Applet)this).getParameter("serialid");
- if (var3 == null) {
- ver.NotRegistered();
- }
-
- ver var4 = new ver(var2, var3);
- this.matched = var4.verifyUser(this.field_0);
- if (!this.matched) {
- ver.NotRegistered();
- }
-
- this.speed = ((Applet)this).getParameter("sizeChange");
- if (this.field_0 != null) {
- this.changeSize = Integer.valueOf(this.speed);
- }
-
- var1 = ((Applet)this).getParameter("speed");
- if (var1 != null) {
- this.sleepTime = Integer.parseInt(var1);
- }
-
- var1 = ((Applet)this).getParameter("color");
- if (var1 != null) {
- createColor var5 = new createColor(var1, ",");
- this.stringColor = var5.getColor();
- } else {
- this.stringColor = new Color(255, 0, 0);
- }
-
- var1 = ((Applet)this).getParameter("background");
- if (var1 != null) {
- createColor var12 = new createColor(var1, ",");
- this.backColor = var12.getColor();
- } else {
- this.backColor = new Color(0, 0, 0);
- }
-
- this.dbg("finish init");
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 501) {
- if (this.userPause) {
- this.engineThread.resume();
- } else {
- this.engineThread.suspend();
- }
-
- this.userPause = !this.userPause;
- } else if (var1.id == 201) {
- this.stop();
- System.exit(0);
- }
-
- return true;
- }
- }
-