home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class Dizzer extends Applet implements Runnable {
- Thread runner;
- String text;
- String FontFace;
- int Size;
- Image OffscreenImage;
- Graphics OffscreenGraphics;
-
- public void init() {
- this.FontFace = ((Applet)this).getParameter("FontFace");
- this.FontFace = this.FontFace == null ? "TimesRoman" : this.FontFace;
- if (((Applet)this).getParameter("Size") == null) {
- this.Size = 26;
- } else {
- this.Size = Integer.parseInt(((Applet)this).getParameter("Size"));
- }
-
- this.text = ((Applet)this).getParameter("Text");
- this.text = this.text == null ? "Dizzer 1.1 (supplied with Lorenz Graf's HTMLtool)" : this.text;
- this.OffscreenImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.OffscreenGraphics = this.OffscreenImage.getGraphics();
- }
-
- public void run() {
- while(true) {
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var1) {
- }
-
- ((Component)this).repaint();
- }
- }
-
- public void update(Graphics var1) {
- this.paint(var1);
- }
-
- public void paint(Graphics var1) {
- Font var2 = new Font(this.FontFace, 1, this.Size);
- this.OffscreenGraphics.setColor(Color.lightGray);
- this.OffscreenGraphics.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
- this.OffscreenGraphics.setColor(Color.red);
- this.OffscreenGraphics.setFont(var2);
- this.OffscreenGraphics.drawString(this.text, (int)(Math.random() * (double)10.0F) + 20, (int)(Math.random() * (double)10.0F) + 20);
- var1.drawImage(this.OffscreenImage, 0, 0, this);
- }
-
- public void stop() {
- if (this.runner != null) {
- this.runner.stop();
- this.runner = null;
- }
-
- }
-
- public void start() {
- if (this.runner == null) {
- this.runner = new Thread(this);
- this.runner.start();
- }
-
- }
-
- public String getAppletInfo() {
- return "Dizzer v1.1 copyright 1997 by Lorenz Graf";
- }
- }
-