home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 25 / nopv25.iso / 046A / COOBAR.ZIP / COOBUT.CLA (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-03  |  6.1 KB  |  311 lines

  1. import java.applet.AudioClip;
  2. import java.awt.Component;
  3. import java.awt.Image;
  4. import java.awt.Rectangle;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7. import java.util.StringTokenizer;
  8.  
  9. class coobut {
  10.    public Rectangle buttonArea = new Rectangle();
  11.    // $FF: renamed from: ID int
  12.    int field_0;
  13.    public String[] label;
  14.    public String name;
  15.    public String szHint = "Content of tooltips for ...";
  16.    public URL uURL;
  17.    public String uURLName;
  18.    public AudioClip[] auSource;
  19.    public String[] auSourceName;
  20.    public int audioMode;
  21.    public String openMode = "_blank";
  22.    public int subOpenMode;
  23.    public int lastChild = -1;
  24.    public int firstChild;
  25.    public Image[] bgImage;
  26.    public String[] bgImageName;
  27.    coobut[] child;
  28.    int bState;
  29.    int fontv = 20;
  30.    int fontSize = 20;
  31.    String barAlign = "Center";
  32.    int[] bevelW;
  33.    int[] bevelH;
  34.    coobar m_applet;
  35.    Component m_cc;
  36.    coobut m_parentBut;
  37.  
  38.    public coobut(coobut other) {
  39.       this.set(other);
  40.    }
  41.  
  42.    public void set(coobut other) {
  43.       this.buttonArea.x = other.buttonArea.x;
  44.       this.buttonArea.y = other.buttonArea.y;
  45.       this.buttonArea.width = other.buttonArea.width;
  46.       this.buttonArea.height = other.buttonArea.height;
  47.       this.field_0 = other.field_0;
  48.       this.label = new String[3];
  49.       this.label[0] = other.label[0];
  50.       this.label[1] = other.label[1];
  51.       this.label[2] = other.label[2];
  52.       this.name = other.name;
  53.       this.szHint = other.szHint;
  54.       this.bevelW = new int[2];
  55.       this.bevelH = new int[2];
  56.       this.bevelW[0] = other.bevelW[0];
  57.       this.bevelH[0] = other.bevelH[0];
  58.       this.bevelW[1] = other.bevelW[1];
  59.       this.bevelH[1] = other.bevelH[1];
  60.       this.barAlign = other.barAlign;
  61.       this.fontv = other.fontv;
  62.       this.fontSize = other.fontSize;
  63.       this.uURL = other.uURL;
  64.       this.uURLName = other.uURLName;
  65.       if (other.auSource != null) {
  66.          this.auSource = new AudioClip[2];
  67.          this.auSource[0] = other.auSource[0];
  68.          this.auSource[1] = other.auSource[1];
  69.       }
  70.  
  71.       if (other.bgImage != null) {
  72.          this.bgImage = new Image[3];
  73.          this.bgImage[0] = other.bgImage[0];
  74.          this.bgImage[1] = other.bgImage[1];
  75.          this.bgImage[2] = other.bgImage[2];
  76.       }
  77.  
  78.       this.auSourceName = new String[2];
  79.       this.auSourceName[0] = other.auSourceName[0];
  80.       this.auSourceName[1] = other.auSourceName[1];
  81.       this.bgImageName = new String[3];
  82.       this.bgImageName[0] = other.bgImageName[0];
  83.       this.bgImageName[1] = other.bgImageName[1];
  84.       this.bgImageName[2] = other.bgImageName[2];
  85.       this.audioMode = other.audioMode;
  86.       this.openMode = other.openMode;
  87.       this.lastChild = other.lastChild;
  88.       this.subOpenMode = other.subOpenMode;
  89.       this.bState = other.bState;
  90.       this.m_applet = other.m_applet;
  91.       this.m_cc = other.m_cc;
  92.       this.m_parentBut = other.m_parentBut;
  93.       if (this.child != null) {
  94.          for(int i = this.firstChild; i < this.lastChild; ++i) {
  95.             this.child[i] = other.child[i];
  96.          }
  97.       }
  98.  
  99.    }
  100.  
  101.    public coobut() {
  102.    }
  103.  
  104.    public coobut(coobar applet, Component cc, coobut parentBut, String in, int totalBut) {
  105.       this.field_0 = parentBut.lastChild;
  106.       this.m_applet = applet;
  107.       this.m_cc = cc;
  108.       this.m_parentBut = parentBut;
  109.       StringTokenizer st = new StringTokenizer(in, "|");
  110.       this.label = new String[3];
  111.  
  112.       try {
  113.          this.label[0] = st.nextToken();
  114.       } catch (Exception var34) {
  115.          this.label[0] = "";
  116.       }
  117.  
  118.       try {
  119.          this.label[1] = st.nextToken();
  120.       } catch (Exception var33) {
  121.          this.label[1] = "";
  122.       }
  123.  
  124.       try {
  125.          this.label[2] = st.nextToken();
  126.       } catch (Exception var32) {
  127.          this.label[2] = "";
  128.       }
  129.  
  130.       try {
  131.          this.uURLName = st.nextToken();
  132.          if (!this.uURLName.trim().equals("")) {
  133.             this.uURL = new URL(this.m_applet.getDocumentBase(), this.uURLName);
  134.          }
  135.       } catch (MalformedURLException var31) {
  136.          this.uURL = null;
  137.       }
  138.  
  139.       this.bgImage = new Image[3];
  140.       this.bgImageName = new String[3];
  141.  
  142.       try {
  143.          this.bgImageName[0] = st.nextToken();
  144.          if (!this.bgImageName[0].trim().equals("")) {
  145.             this.m_applet.getDocumentBase();
  146.             this.bgImage[0] = this.m_applet.getImage(this.m_applet.getDocumentBase(), this.bgImageName[0]);
  147.             this.m_applet.m_common.tracker.addImage(this.bgImage[0], ++this.m_applet.numTrack);
  148.          }
  149.       } catch (Exception var30) {
  150.          this.bgImage[0] = null;
  151.       }
  152.  
  153.       try {
  154.          this.bgImageName[1] = st.nextToken();
  155.          if (!this.bgImageName[1].trim().equals("")) {
  156.             this.bgImage[1] = this.m_applet.getImage(this.m_applet.getDocumentBase(), this.bgImageName[1]);
  157.             this.m_applet.m_common.tracker.addImage(this.bgImage[1], ++this.m_applet.numTrack);
  158.          }
  159.       } catch (Exception var29) {
  160.          this.bgImage[1] = null;
  161.       }
  162.  
  163.       try {
  164.          this.bgImageName[2] = st.nextToken();
  165.          if (!this.bgImageName[2].trim().equals("")) {
  166.             this.bgImage[2] = this.m_applet.getImage(this.m_applet.getDocumentBase(), this.bgImageName[2]);
  167.             this.m_applet.m_common.tracker.addImage(this.bgImage[2], ++this.m_applet.numTrack);
  168.          }
  169.       } catch (Exception var28) {
  170.          this.bgImage[2] = null;
  171.       }
  172.  
  173.       this.auSource = new AudioClip[2];
  174.       this.auSourceName = new String[2];
  175.  
  176.       try {
  177.          this.auSourceName[0] = st.nextToken();
  178.          if (!this.auSourceName[0].trim().equals("")) {
  179.             this.auSource[0] = this.m_applet.getAudioClip(this.m_applet.getDocumentBase(), this.auSourceName[0]);
  180.          }
  181.       } catch (Exception var27) {
  182.          this.auSource[0] = null;
  183.       }
  184.  
  185.       try {
  186.          this.auSourceName[1] = st.nextToken();
  187.          if (!this.auSourceName[1].trim().equals("")) {
  188.             this.auSource[1] = this.m_applet.getAudioClip(this.m_applet.getDocumentBase(), this.auSourceName[1]);
  189.          }
  190.       } catch (Exception var26) {
  191.          this.auSource[1] = null;
  192.       }
  193.  
  194.       try {
  195.          this.szHint = st.nextToken();
  196.       } catch (Exception var25) {
  197.          this.szHint = "";
  198.       }
  199.  
  200.       try {
  201.          this.buttonArea.width = Integer.valueOf(st.nextToken());
  202.       } catch (Exception var24) {
  203.          this.buttonArea.width = 0;
  204.       }
  205.  
  206.       try {
  207.          this.buttonArea.height = Integer.valueOf(st.nextToken());
  208.       } catch (Exception var23) {
  209.          this.buttonArea.height = 0;
  210.       }
  211.  
  212.       try {
  213.          this.audioMode = Integer.valueOf(st.nextToken());
  214.       } catch (Exception var22) {
  215.          this.audioMode = 0;
  216.       }
  217.  
  218.       try {
  219.          this.subOpenMode = Integer.valueOf(st.nextToken());
  220.       } catch (Exception var21) {
  221.          this.subOpenMode = 0;
  222.       }
  223.  
  224.       try {
  225.          this.openMode = st.nextToken();
  226.       } catch (Exception var20) {
  227.          this.openMode = "_blank";
  228.       }
  229.  
  230.       try {
  231.          this.barAlign = st.nextToken();
  232.       } catch (Exception var19) {
  233.          this.barAlign = "Center";
  234.       }
  235.  
  236.       this.barAlign.toUpperCase();
  237.       this.bevelW = new int[2];
  238.       this.bevelH = new int[2];
  239.  
  240.       try {
  241.          this.bevelW[0] = Integer.valueOf(st.nextToken());
  242.       } catch (Exception var18) {
  243.          this.bevelW[0] = 2;
  244.       }
  245.  
  246.       try {
  247.          this.bevelH[0] = Integer.valueOf(st.nextToken());
  248.       } catch (Exception var17) {
  249.          this.bevelH[0] = 2;
  250.       }
  251.  
  252.       try {
  253.          this.bevelW[1] = Integer.valueOf(st.nextToken());
  254.       } catch (Exception var16) {
  255.          this.bevelW[1] = 3;
  256.       }
  257.  
  258.       try {
  259.          this.bevelH[1] = Integer.valueOf(st.nextToken());
  260.       } catch (Exception var15) {
  261.          this.bevelH[1] = 3;
  262.       }
  263.  
  264.       try {
  265.          this.fontSize = Integer.valueOf(st.nextToken());
  266.       } catch (Exception var14) {
  267.          this.fontSize = 20;
  268.       }
  269.  
  270.       try {
  271.          this.fontv = Integer.valueOf(st.nextToken());
  272.       } catch (Exception var13) {
  273.          this.fontv = 20;
  274.       }
  275.  
  276.       if (!this.m_parentBut.name.equals("button")) {
  277.          int numOfRow = totalBut / this.m_applet.maxNumSub + 1;
  278.          int whichRow = this.field_0 / numOfRow;
  279.          int whichCell = this.field_0 - whichRow * numOfRow;
  280.          this.buttonArea.x = whichCell * this.buttonArea.width;
  281.          this.buttonArea.y = whichRow * (this.buttonArea.height + this.m_applet.gap);
  282.       } else {
  283.          if (this.m_applet.m_common.releaseLevel == this.m_applet.m_common.TheAdware) {
  284.             ++this.field_0;
  285.             int numOfRow = totalBut + 1;
  286.          }
  287.  
  288.          int whichRow = this.field_0 / this.m_applet.barNum;
  289.          int whichCell = this.field_0 - whichRow * this.m_applet.barNum;
  290.          int startPos = 0;
  291.          int rr = totalBut / this.m_applet.barNum * this.m_applet.barNum;
  292.          if (rr < totalBut && this.field_0 > rr - 1) {
  293.             int ttt = this.m_applet.barNum - (totalBut - rr);
  294.             if (this.m_applet.barDir == 0) {
  295.                startPos = ttt * this.buttonArea.width / 2;
  296.             } else {
  297.                startPos = ttt * this.buttonArea.height / 2;
  298.             }
  299.          }
  300.  
  301.          if (this.m_applet.barDir == 0) {
  302.             this.buttonArea.x = startPos + whichCell * (this.buttonArea.width + this.m_applet.gap);
  303.             this.buttonArea.y = whichRow * (this.buttonArea.height + this.m_applet.gap);
  304.          } else {
  305.             this.buttonArea.x = whichRow * (this.buttonArea.width + this.m_applet.gap);
  306.             this.buttonArea.y = startPos + whichCell * (this.buttonArea.height + this.m_applet.gap);
  307.          }
  308.       }
  309.    }
  310. }
  311.