home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 November / PCO1197.ISO / FilesBBS / WIN95 / BUTTONS.EXE / tmp / buttons / ImageButton2.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-09-19  |  13.7 KB  |  622 lines

  1. import java.applet.Applet;
  2. import java.applet.AudioClip;
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.FontMetrics;
  8. import java.awt.Graphics;
  9. import java.awt.Image;
  10. import java.awt.MediaTracker;
  11. import java.net.MalformedURLException;
  12. import java.net.URL;
  13. import java.util.Date;
  14.  
  15. public class ImageButton2 extends Applet implements Runnable {
  16.    Thread runner;
  17.    MediaTracker tracker;
  18.    String marker = "nhgube EWUZ";
  19.    boolean initialized = false;
  20.    String loadText;
  21.    Image offscreenI;
  22.    Image offscreenResetI;
  23.    Graphics offscreenG;
  24.    Graphics offscreenResetG;
  25.    Image background;
  26.    Color panelColor;
  27.    String[] statusS = new String[]{"_up_", "_above_", "_down_"};
  28.    int numberOffButtons;
  29.    Image[][] button;
  30.    int[] buttonS;
  31.    // $FF: renamed from: x int[]
  32.    int[] field_0;
  33.    // $FF: renamed from: y int[]
  34.    int[] field_1;
  35.    int[][] defaultButtonNumber;
  36.    int buttonPressed;
  37.    int mouseX;
  38.    int mouseY;
  39.    String defaultFont;
  40.    String[][] text;
  41.    int[][] height;
  42.    int[][] type;
  43.    int[][] color;
  44.    int[] soundTime;
  45.    long timeFlag;
  46.    String marker2 = "ina qra Oretu";
  47.    String[] statusText;
  48.    int statusTextNumber = -1;
  49.    boolean noString;
  50.    boolean vertical;
  51.    boolean mouseIn;
  52.    boolean mouseDown;
  53.    AudioClip[][] sound;
  54.    int playButtonPressed;
  55.    int lastPlayButtonPressed;
  56.    int playButtonUp;
  57.    int playButtonAbove;
  58.    URL[] url;
  59.    String[] target;
  60.    boolean[] noUrl;
  61.  
  62.    public void init() {
  63.       this.loadText = ((Applet)this).getParameter("loadmessage");
  64.       if (this.loadText == null) {
  65.          this.loadText = "loading";
  66.       }
  67.  
  68.       do {
  69.          while(this.marker != "nhgube EWUZ") {
  70.          }
  71.       } while(this.marker2 != "ina qra Oretu");
  72.  
  73.    }
  74.  
  75.    public void initApplet() {
  76.       this.offscreenI = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  77.       this.offscreenG = this.offscreenI.getGraphics();
  78.       this.offscreenResetI = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  79.       this.offscreenResetG = this.offscreenResetI.getGraphics();
  80.       this.tracker = new MediaTracker(this);
  81.       this.numberOffButtons = this.getNumber("numberoffbuttons", 1, true);
  82.       this.button = new Image[this.numberOffButtons + 1][3];
  83.       this.field_0 = new int[this.numberOffButtons + 1];
  84.       this.field_1 = new int[this.numberOffButtons + 1];
  85.       this.text = new String[this.numberOffButtons + 1][3];
  86.       this.height = new int[this.numberOffButtons + 1][3];
  87.       this.type = new int[this.numberOffButtons + 1][3];
  88.       this.color = new int[this.numberOffButtons + 1][3];
  89.       this.sound = new AudioClip[this.numberOffButtons + 1][3];
  90.       this.buttonS = new int[this.numberOffButtons + 1];
  91.       this.statusText = new String[this.numberOffButtons + 1];
  92.       this.url = new URL[this.numberOffButtons + 1];
  93.       this.target = new String[this.numberOffButtons + 1];
  94.       this.noUrl = new boolean[this.numberOffButtons + 1];
  95.       this.soundTime = new int[this.numberOffButtons + 1];
  96.       this.defaultButtonNumber = new int[this.numberOffButtons + 1][3];
  97.       this.buttonToTracker(0, 0, "button_up_default", 0, false);
  98.       this.buttonToTracker(0, 1, "button_above_default", 0, false);
  99.       this.buttonToTracker(0, 2, "button_down_default", 0, false);
  100.       this.doTracker(0);
  101.  
  102.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  103.          if (this.button[0][0] == null) {
  104.             this.buttonToTracker(number, 0, "button_up_" + number, 1, true);
  105.          } else {
  106.             this.buttonToTracker(number, 0, "button_up_" + number, 1, false);
  107.          }
  108.  
  109.          this.buttonToTracker(number, 1, "button_above_" + number, 1, false);
  110.          this.buttonToTracker(number, 2, "button_down_" + number, 1, false);
  111.       }
  112.  
  113.       this.doTracker(1);
  114.       String tempString = this.getString("background", false);
  115.       if (!this.noString) {
  116.          this.background = ((Applet)this).getImage(((Applet)this).getCodeBase(), tempString);
  117.          this.tracker.addImage(this.background, 2);
  118.          this.doTracker(2);
  119.          if (this.tracker.statusID(2, true) == 1) {
  120.             this.errorOut("background not loaded retrying");
  121.          }
  122.       }
  123.  
  124.       if (this.tracker.isErrorID(0) || this.tracker.isErrorID(1) || this.tracker.isErrorID(2)) {
  125.          this.errorOut("IO error some Images not loaded");
  126.       }
  127.  
  128.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  129.          for(int status = 0; status <= 2; ++status) {
  130.             if (this.button[number][status] == null) {
  131.                this.button[number][status] = this.button[this.defaultButtonNumber[number][status]][status];
  132.             }
  133.          }
  134.       }
  135.  
  136.       tempString = this.getString("direction", true);
  137.       if (tempString.equals("vertical")) {
  138.          this.vertical = true;
  139.       } else if (tempString.equals("horizontal")) {
  140.          this.vertical = false;
  141.       } else {
  142.          this.errorOut("direction not equals vertical or horizontal");
  143.       }
  144.  
  145.       int length = 0;
  146.  
  147.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  148.          if (this.vertical) {
  149.             length += this.button[number][0].getHeight(this);
  150.          } else {
  151.             length += this.button[number][0].getWidth(this);
  152.          }
  153.       }
  154.  
  155.       if (this.vertical) {
  156.          this.field_0[1] = (((Component)this).size().width - this.button[1][0].getWidth(this)) / 2;
  157.          this.field_1[1] = (((Component)this).size().height - length) / (this.numberOffButtons + 1);
  158.  
  159.          for(int number = 2; number <= this.numberOffButtons; ++number) {
  160.             Image var10003 = this.button[number][0];
  161.             this.field_0[number] = (((Component)this).size().width - var10003.getWidth(this)) / 2;
  162.             this.field_1[number] = this.field_1[number - 1] + this.button[number - 1][0].getHeight(this) + this.field_1[1];
  163.          }
  164.       } else {
  165.          this.field_0[1] = (((Component)this).size().width - length) / (this.numberOffButtons + 1);
  166.          this.field_1[1] = (((Component)this).size().height - this.button[1][0].getHeight(this)) / 2;
  167.  
  168.          for(int number = 2; number <= this.numberOffButtons; ++number) {
  169.             this.field_0[number] = this.field_0[number - 1] + this.button[number - 1][0].getWidth(this) + this.field_0[1];
  170.             Image var51 = this.button[number][0];
  171.             this.field_1[number] = (((Component)this).size().height - var51.getHeight(this)) / 2;
  172.          }
  173.       }
  174.  
  175.       this.field_0[0] = this.getNumber("button_x_default", 0, false);
  176.       boolean xUser = !this.noString;
  177.       this.field_1[0] = this.getNumber("button_y_default", 0, false);
  178.       boolean yUser = !this.noString;
  179.  
  180.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  181.          if (xUser) {
  182.             this.field_0[number] = this.field_0[0];
  183.          }
  184.  
  185.          if (yUser) {
  186.             this.field_1[number] = this.field_1[0];
  187.          }
  188.  
  189.          this.field_0[number] = this.getNumber("button_x_" + number, this.field_0[number], false);
  190.          this.field_1[number] = this.getNumber("button_y_" + number, this.field_1[number], false);
  191.       }
  192.  
  193.       this.defaultFont = this.getString("defaultfont", false);
  194.       if (this.noString) {
  195.          this.defaultFont = ((Component)this).getGraphics().getFont().getName();
  196.       }
  197.  
  198.       for(int status = 0; status <= 2; ++status) {
  199.          this.height[0][status] = this.getNumber("text_height" + this.statusS[status] + "default", 12, false);
  200.          this.type[0][status] = this.getNumber("text_type" + this.statusS[status] + "default", 0, false);
  201.          this.color[0][status] = this.getNumber("text_color" + this.statusS[status] + "default", 0, false);
  202.       }
  203.  
  204.       for(int number = 0; number <= this.numberOffButtons; ++number) {
  205.          for(int status = 0; status <= 2; ++status) {
  206.             if (this.button[number][status] != null) {
  207.                int buttonWidth = this.button[number][status].getWidth(this);
  208.                int buttonHeight = this.button[number][status].getHeight(this);
  209.                this.text[number][status] = this.getString("text" + this.statusS[status] + number, false);
  210.                if (!this.noString) {
  211.                   Image tempScreenI = ((Component)this).createImage(buttonWidth, buttonHeight);
  212.                   Graphics tempScreenG = tempScreenI.getGraphics();
  213.                   tempScreenG.drawImage(this.button[number][status], 0, 0, this);
  214.                   int textHeight = this.getNumber("text_height" + this.statusS[status] + number, this.height[0][status], false);
  215.                   int textType = this.getNumber("text_type" + this.statusS[status] + number, this.type[0][status], false);
  216.                   Color textColor = new Color(this.getNumber("text_color" + this.statusS[status] + number, this.color[0][status], false));
  217.                   Font font = new Font(this.defaultFont, textType, textHeight);
  218.                   tempScreenG.setFont(font);
  219.                   FontMetrics fm = tempScreenG.getFontMetrics();
  220.                   tempScreenG.setColor(textColor);
  221.                   int x = (buttonWidth - fm.stringWidth(this.text[number][status])) / 2;
  222.                   int y = (buttonHeight + fm.getAscent() + 1) / 2 - fm.getDescent();
  223.                   tempScreenG.drawString(this.text[number][status], x, y);
  224.                   this.button[number][status] = tempScreenI;
  225.                }
  226.             }
  227.          }
  228.       }
  229.  
  230.       this.sound[0][0] = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), ((Applet)this).getParameter("sound_up_default"));
  231.       this.sound[0][1] = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), ((Applet)this).getParameter("sound_above_default"));
  232.       this.sound[0][2] = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), ((Applet)this).getParameter("sound_down_default"));
  233.  
  234.       for(int s = 0; s <= 2; ++s) {
  235.          if (this.sound[0][s] != null) {
  236.             this.sound[0][s].play();
  237.             this.sound[0][s].stop();
  238.          }
  239.       }
  240.  
  241.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  242.          for(int status = 0; status <= 2; ++status) {
  243.             tempString = this.getString("sound" + this.statusS[status] + number, false);
  244.             if (!this.noString) {
  245.                this.sound[number][status] = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), tempString);
  246.                this.sound[number][status].play();
  247.                this.sound[number][status].stop();
  248.             }
  249.          }
  250.       }
  251.  
  252.       this.soundTime[0] = this.getNumber("wait_for_sound_default", 0, false);
  253.  
  254.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  255.          this.soundTime[number] = this.getNumber("wait_for_sound_" + number, this.soundTime[0], false);
  256.       }
  257.  
  258.       tempString = ((Applet)this).getParameter("target_default");
  259.       if (tempString != null) {
  260.          for(int number = 1; number <= this.numberOffButtons; ++number) {
  261.             this.target[number] = tempString;
  262.          }
  263.       }
  264.  
  265.       boolean explorer = System.getProperty("java.vendor").equals("Microsoft Corp.");
  266.  
  267.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  268.          tempString = ((Applet)this).getParameter("url_" + number);
  269.          if (tempString != null) {
  270.             this.statusText[number] = tempString;
  271.             int anchor = tempString.lastIndexOf("#");
  272.             if (explorer && anchor != -1) {
  273.                tempString = tempString.substring(0, anchor) + "#" + tempString.substring(anchor, tempString.length());
  274.             }
  275.  
  276.             if (!tempString.startsWith("http://") && !tempString.startsWith("mailto:")) {
  277.                String codebase = ((Applet)this).getCodeBase().toString();
  278.                int codebaseLength = codebase.length();
  279.                String codebaseEnd = codebase.substring(codebaseLength - 4, codebaseLength);
  280.                codebaseEnd.toUpperCase();
  281.                if (!codebaseEnd.equals("HTML") && !codebase.equals(".HTM")) {
  282.                   boolean var50 = false;
  283.                } else {
  284.                   boolean var10000 = true;
  285.                }
  286.  
  287.                int lastSlash = codebase.lastIndexOf("/");
  288.                codebase = codebase.substring(0, lastSlash + 1);
  289.                tempString = codebase + tempString;
  290.             }
  291.  
  292.             try {
  293.                this.url[number] = new URL(tempString);
  294.             } catch (MalformedURLException var23) {
  295.                this.errorOut("button " + number + " illegal url.");
  296.             }
  297.  
  298.             tempString = ((Applet)this).getParameter("target_" + number);
  299.             if (tempString != null) {
  300.                this.target[number] = tempString;
  301.             }
  302.  
  303.             this.noUrl[number] = false;
  304.          } else {
  305.             this.noUrl[number] = true;
  306.          }
  307.       }
  308.  
  309.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  310.          tempString = ((Applet)this).getParameter("statustext_" + number);
  311.          if (tempString != null) {
  312.             this.statusText[number] = tempString;
  313.          }
  314.       }
  315.  
  316.       this.panelColor = new Color(this.getNumber("bgcolor", 0, false));
  317.       ((Component)this).setBackground(this.panelColor);
  318.       this.offscreenResetG.setColor(this.panelColor);
  319.       this.offscreenResetG.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  320.       if (this.background != null) {
  321.          for(int x = 0; x < ((Component)this).size().width; x += this.background.getWidth(this)) {
  322.             for(int y = 0; y < ((Component)this).size().height; y += this.background.getHeight(this)) {
  323.                this.offscreenResetG.drawImage(this.background, x, y, this);
  324.             }
  325.          }
  326.       }
  327.  
  328.       for(int number = 1; number <= this.numberOffButtons; ++number) {
  329.          if (this.button[number][0] != null) {
  330.             this.offscreenResetG.drawImage(this.button[number][0], this.field_0[number], this.field_1[number], this);
  331.          }
  332.       }
  333.  
  334.       this.offscreenG.drawImage(this.offscreenResetI, 0, 0, this);
  335.       this.initialized = true;
  336.    }
  337.  
  338.    private void buttonToTracker(int number, int status, String parameter, int id, boolean mustBeThere) {
  339.       String tempString = this.getString(parameter, mustBeThere);
  340.       if (!this.noString) {
  341.          if (!tempString.startsWith("=")) {
  342.             this.button[number][status] = ((Applet)this).getImage(((Applet)this).getCodeBase(), tempString);
  343.             this.tracker.addImage(this.button[number][status], id);
  344.          } else {
  345.             try {
  346.                this.defaultButtonNumber[number][status] = Integer.parseInt(tempString.substring(1, tempString.length()));
  347.             } catch (NumberFormatException var7) {
  348.                this.errorOut("parameter " + parameter + " wrong format");
  349.             }
  350.          }
  351.       }
  352.    }
  353.  
  354.    private void doTracker(int id) {
  355.       try {
  356.          this.tracker.waitForID(id);
  357.       } catch (InterruptedException var2) {
  358.          this.errorOut(" IO error image loading is interupted");
  359.       }
  360.  
  361.       if (this.tracker.statusID(id, true) == 1) {
  362.          this.errorOut("Image not loaded retrying");
  363.       }
  364.  
  365.    }
  366.  
  367.    public String getString(String parameter, boolean mustBeThere) {
  368.       String tempString = ((Applet)this).getParameter(parameter);
  369.       this.noString = false;
  370.       if (tempString != null) {
  371.          return tempString;
  372.       } else {
  373.          if (mustBeThere) {
  374.             this.errorOut("Parameter " + parameter + " isn't found");
  375.          }
  376.  
  377.          this.noString = true;
  378.          return null;
  379.       }
  380.    }
  381.  
  382.    private int getNumber(String parameter, int defaultNumber, boolean mustBeThere) {
  383.       String tempString = ((Applet)this).getParameter(parameter);
  384.  
  385.       try {
  386.          if (tempString == null) {
  387.             if (mustBeThere) {
  388.                this.errorOut("Parameter " + parameter + " isn't found");
  389.             }
  390.  
  391.             this.noString = true;
  392.             return defaultNumber;
  393.          } else {
  394.             return tempString.startsWith("#") ? Integer.parseInt(tempString.substring(1), 16) : Integer.parseInt(tempString);
  395.          }
  396.       } catch (NumberFormatException var5) {
  397.          this.errorOut("ImageButton2: Illegal number " + tempString);
  398.          return defaultNumber;
  399.       }
  400.    }
  401.  
  402.    public void run() {
  403.       if (!this.initialized) {
  404.          ((Component)this).getGraphics().drawString(this.loadText, 3, ((Component)this).size().height / 2);
  405.          ((Component)this).repaint();
  406.          this.initApplet();
  407.       }
  408.  
  409.       this.drawer(-1, -1);
  410.  
  411.       for(; Thread.currentThread() == this.runner; this.pause(333)) {
  412.          if (this.timeFlag != 0L && this.timeFlag < (new Date()).getTime()) {
  413.             if (!this.noUrl[this.lastPlayButtonPressed]) {
  414.                if (this.target[this.lastPlayButtonPressed] == null) {
  415.                   ((Applet)this).getAppletContext().showDocument(this.url[this.lastPlayButtonPressed]);
  416.                } else {
  417.                   ((Applet)this).getAppletContext().showDocument(this.url[this.lastPlayButtonPressed], this.target[this.lastPlayButtonPressed]);
  418.                }
  419.             }
  420.  
  421.             this.timeFlag = 0L;
  422.             this.buttonS[this.lastPlayButtonPressed] = 2;
  423.             this.buttonPressed = -1;
  424.             this.drawer(this.mouseX, this.mouseY);
  425.          }
  426.       }
  427.  
  428.    }
  429.  
  430.    public void start() {
  431.       if (this.runner == null) {
  432.          this.runner = new Thread(this);
  433.          this.runner.start();
  434.       }
  435.  
  436.    }
  437.  
  438.    public void stop() {
  439.       if (this.runner != null) {
  440.          this.runner.stop();
  441.          this.runner = null;
  442.       }
  443.  
  444.    }
  445.  
  446.    public boolean handleEvent(Event evt) {
  447.       switch (evt.id) {
  448.          case 501:
  449.             this.mouseDown = true;
  450.             if (this.mouseIn) {
  451.                this.drawer(evt.x, evt.y);
  452.             }
  453.  
  454.             return true;
  455.          case 502:
  456.             this.mouseDown = false;
  457.             if (this.mouseIn) {
  458.                this.drawer(evt.x, evt.y);
  459.             }
  460.  
  461.             return true;
  462.          case 503:
  463.             if (this.mouseIn) {
  464.                this.drawer(evt.x, evt.y);
  465.             }
  466.  
  467.             return true;
  468.          case 504:
  469.             this.mouseIn = true;
  470.             this.drawer(evt.x, evt.y);
  471.             return true;
  472.          case 505:
  473.             this.mouseIn = false;
  474.             this.drawer(evt.x, evt.y);
  475.             return true;
  476.          case 506:
  477.             this.mouseDown = true;
  478.             if (this.mouseIn) {
  479.                this.drawer(evt.x, evt.y);
  480.             }
  481.  
  482.             return true;
  483.          default:
  484.             return super.handleEvent(evt);
  485.       }
  486.    }
  487.  
  488.    private void drawer(int mouseX, int mouseY) {
  489.       if (this.initialized) {
  490.          this.mouseX = mouseX;
  491.          this.mouseY = mouseY;
  492.          this.offscreenG.drawImage(this.offscreenResetI, 0, 0, this);
  493.          this.playButtonPressed = -1;
  494.          this.playButtonAbove = -1;
  495.          this.playButtonUp = -1;
  496.          this.statusTextNumber = -1;
  497.  
  498.          for(int number = 1; number <= this.numberOffButtons; ++number) {
  499.             if (this.mouseIn) {
  500.                if (this.field_0[number] <= mouseX && this.field_0[number] + this.button[number][0].getWidth(this) > mouseX && this.field_1[number] < mouseY && this.field_1[number] + this.button[number][0].getHeight(this) >= mouseY) {
  501.                   if (this.mouseDown) {
  502.                      this.drawButton(number, 2);
  503.                      if (this.buttonS[number] != 2) {
  504.                         this.buttonS[number] = 2;
  505.                         this.buttonPressed = number;
  506.                         this.playButtonPressed = number;
  507.                      }
  508.                   } else {
  509.                      this.drawButton(number, 1);
  510.                      if (this.buttonS[number] != 1) {
  511.                         if (this.buttonS[number] != 2) {
  512.                            this.playButtonAbove = number;
  513.                         }
  514.  
  515.                         this.buttonS[number] = 1;
  516.                      }
  517.  
  518.                      if (this.statusText[number] != null) {
  519.                         this.statusTextNumber = number;
  520.                      }
  521.                   }
  522.                } else if (this.buttonS[number] != 0) {
  523.                   this.buttonS[number] = 0;
  524.                   this.playButtonUp = number;
  525.                }
  526.             } else {
  527.                if (this.buttonS[number] == 1 || this.buttonS[number] == 2) {
  528.                   this.playButtonUp = number;
  529.                }
  530.  
  531.                this.buttonS[number] = 0;
  532.             }
  533.          }
  534.  
  535.          if (this.playButtonUp != -1 && this.playButtonUp != this.buttonPressed) {
  536.             this.play(this.playButtonUp, 0);
  537.          }
  538.  
  539.          if (this.playButtonAbove != -1 && this.playButtonAbove != this.buttonPressed) {
  540.             this.play(this.playButtonAbove, 1);
  541.          }
  542.  
  543.          if (this.playButtonPressed != -1) {
  544.             this.play(this.playButtonPressed, 2);
  545.             this.timeFlag = (new Date()).getTime() + (long)this.soundTime[this.playButtonPressed];
  546.             this.lastPlayButtonPressed = this.playButtonPressed;
  547.          }
  548.  
  549.          if (this.buttonPressed > 0) {
  550.             this.drawButton(this.buttonPressed, 2);
  551.             this.buttonS[this.buttonPressed] = 2;
  552.          }
  553.  
  554.          if (this.timeFlag > (new Date()).getTime()) {
  555.             this.drawButton(this.lastPlayButtonPressed, 2);
  556.             this.buttonS[this.lastPlayButtonPressed] = 2;
  557.          }
  558.  
  559.          if (this.playButtonUp != -1) {
  560.             ((Applet)this).getAppletContext().showStatus(" ");
  561.          }
  562.  
  563.          if (this.playButtonAbove != -1 && this.statusTextNumber != -1 && this.initialized) {
  564.             ((Applet)this).getAppletContext().showStatus(this.statusText[this.statusTextNumber]);
  565.          }
  566.  
  567.          ((Component)this).repaint();
  568.       }
  569.    }
  570.  
  571.    private void play(int number, int status) {
  572.       if (this.initialized) {
  573.          if (this.sound[number][status] != null || this.sound[0][status] != null) {
  574.             if (this.sound[number][status] != null) {
  575.                this.sound[number][status].play();
  576.             } else {
  577.                this.sound[0][status].play();
  578.             }
  579.          }
  580.       }
  581.    }
  582.  
  583.    public void update(Graphics g) {
  584.       if (this.initialized && this.offscreenI != null) {
  585.          g.drawImage(this.offscreenI, 0, 0, this);
  586.       }
  587.  
  588.    }
  589.  
  590.    public void paint(Graphics g) {
  591.       this.update(g);
  592.    }
  593.  
  594.    public void pause(int sleeper) {
  595.       try {
  596.          Thread.sleep((long)sleeper);
  597.       } catch (InterruptedException var2) {
  598.       }
  599.    }
  600.  
  601.    public void errorOut(String error) {
  602.       ((Applet)this).getAppletContext().showStatus(error);
  603.       System.out.println(error);
  604.       this.pause(5000);
  605.    }
  606.  
  607.    public String getAppletInfo() {
  608.       return "(c) 1997 RJHM van den Bergh\nFrom Java download site : http://www.nedernet.nl/~rvdb\nrvdb@nedernet.nl";
  609.    }
  610.  
  611.    private void drawButton(int number, int status) {
  612.       if (this.button[number][status] != null) {
  613.          this.offscreenG.drawImage(this.button[number][status], this.field_0[number], this.field_1[number], this);
  614.       } else {
  615.          if (status == 2 && this.button[number][1] != null) {
  616.             this.offscreenG.drawImage(this.button[number][1], this.field_0[number], this.field_1[number], this);
  617.          }
  618.  
  619.       }
  620.    }
  621. }
  622.