home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Graphics;
-
- public class MouseTrack extends Applet {
- // $FF: renamed from: mx int
- int field_0;
- // $FF: renamed from: my int
- int field_1;
- int onaroll;
-
- public void mouseExit() {
- this.onaroll = 0;
- ((Component)this).repaint();
- }
-
- public boolean mouseMove(Event evt, int x, int y) {
- if (x % 3 == 0 && y % 3 == 0) {
- ((Component)this).repaint();
- }
-
- return true;
- }
-
- public boolean mouseDown(Event evt, int x, int y) {
- ((Component)this).requestFocus();
- if (this.field_0 < x && x < this.field_0 + ((Component)this).size().width / 10 - 1 && this.field_1 < y && y < this.field_1 + ((Component)this).size().height / 10 - 1) {
- if (this.onaroll > 0) {
- switch (this.onaroll % 4) {
- case 0:
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/tiptoe.thru.the.tulips.au");
- break;
- case 1:
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/danger,danger...!.au");
- break;
- case 2:
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/adapt-or-die.au");
- break;
- case 3:
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/cannot.be.completed.au");
- }
-
- ++this.onaroll;
- if (this.onaroll > 5) {
- ((Applet)this).getAppletContext().showStatus("You're on your way to THE HALL OF FAME:" + this.onaroll + "Hits!");
- } else {
- ((Applet)this).getAppletContext().showStatus("YOU'RE ON A ROLL:" + this.onaroll + "Hits!");
- }
- } else {
- ((Applet)this).getAppletContext().showStatus("HIT IT AGAIN! AGAIN!");
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/that.hurts.au");
- this.onaroll = 1;
- }
- } else {
- ((Applet)this).getAppletContext().showStatus("You hit nothing at (" + x + ", " + y + "), exactly");
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/thin.bell.au");
- this.onaroll = 0;
- }
-
- ((Component)this).repaint();
- return true;
- }
-
- public void keyDown(int key) {
- ((Component)this).requestFocus();
- this.onaroll = 0;
- ((Applet)this).play(((Applet)this).getCodeBase(), "sounds/ip.au");
- }
-
- public void mouseEnter() {
- ((Component)this).repaint();
- }
-
- public void init() {
- this.onaroll = 0;
- ((Applet)this).resize(500, 500);
- }
-
- public void paint(Graphics g) {
- g.drawRect(0, 0, ((Component)this).size().width - 1, ((Component)this).size().height - 1);
- this.field_0 = (int)(Math.random() * (double)1000.0F) % (((Component)this).size().width - ((Component)this).size().width / 10);
- this.field_1 = (int)(Math.random() * (double)1000.0F) % (((Component)this).size().height - ((Component)this).size().height / 10);
- g.drawRect(this.field_0, this.field_1, ((Component)this).size().width / 10 - 1, ((Component)this).size().height / 10 - 1);
- }
- }
-