home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 22 / AMUG_22-1.ISO / Files / Internet / Java / spinalink-3.sit / spindem3 / SpinDemo1.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-22  |  7.0 KB  |  255 lines  |  [Clss/CWIE]

  1. import java.applet.Applet;
  2. import java.applet.AppletContext;
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Font;
  8. import java.awt.Graphics;
  9. import java.awt.Image;
  10. import java.awt.LayoutManager;
  11. import java.awt.MediaTracker;
  12. import java.awt.image.ImageObserver;
  13. import java.io.IOException;
  14. import java.net.MalformedURLException;
  15. import java.net.URL;
  16.  
  17. public class SpinDemo1 extends Applet {
  18.    // $FF: renamed from: n java.awt.Font
  19.    Font field_0;
  20.    // $FF: renamed from: bn java.awt.Image
  21.    Image field_1;
  22.    private final String bnn = "BackImage";
  23.    private String bnnn = "_self";
  24.    private URL my_page;
  25.    private String STmy_page;
  26.    boolean allowedon;
  27.    private String WhICHAppID;
  28.    private String proto_my_page;
  29.    private final String Fametoopen = "Frame";
  30.    SpinDemo2 nnnn;
  31.    SpinDemo3 gotoURL;
  32.    SpinDemo3 disptext;
  33.    // $FF: renamed from: md boolean
  34.    boolean field_2;
  35.    int mdx;
  36.    int mdy;
  37.    private String[] hyhy;
  38.    private String[] bnnnn;
  39.    private int m_Number;
  40.    private int increase = 1;
  41.    private Image ghy;
  42.    private Dimension ghjb;
  43.    private Graphics ghyb;
  44.    int bobt;
  45.    boolean xzxzHex;
  46.  
  47.    public void activatebrother() {
  48.       this.nnnn.repaint();
  49.    }
  50.  
  51.    public void stop() {
  52.       this.gotoURL.stop();
  53.    }
  54.  
  55.    public void gotourl() {
  56.       AppletContext ac = ((Applet)this).getAppletContext();
  57.  
  58.       try {
  59.          new URL(this.bnnnn[this.increase]);
  60.       } catch (MalformedURLException var4) {
  61.       } catch (IOException var5) {
  62.       }
  63.  
  64.    }
  65.  
  66.    boolean ftxx() {
  67.       return true;
  68.    }
  69.  
  70.    public void paint(Graphics g) {
  71.       this.method_0(g);
  72.       this.method_1(g);
  73.    }
  74.  
  75.    Color gogoxx(String col) {
  76.       String parameterValue = col;
  77.       if (col.startsWith("#")) {
  78.          parameterValue = col.substring(1);
  79.       }
  80.  
  81.       Color result;
  82.       try {
  83.          int intValue = Integer.parseInt(parameterValue, 16);
  84.          result = new Color(intValue);
  85.       } catch (Exception var7) {
  86.          result = Color.red;
  87.       }
  88.  
  89.       return result;
  90.    }
  91.  
  92.    // $FF: renamed from: xx (java.awt.Graphics) void
  93.    public void method_0(Graphics g) {
  94.       Dimension d = ((Component)this).size();
  95.       g.setColor(Color.lightGray);
  96.       g.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  97.       if (this.field_1 != null) {
  98.          int wid = this.field_1.getWidth(this);
  99.          int hei = this.field_1.getHeight(this);
  100.          int widAp = ((Component)this).size().width;
  101.          int heiAp = ((Component)this).size().height;
  102.          int dede = widAp / wid + 1;
  103.          int dedhex = heiAp / hei + 1;
  104.  
  105.          for(int x = 0; x <= dedhex; ++x) {
  106.             for(int i = 0; i <= dede; ++i) {
  107.                g.drawImage(this.field_1, i * wid, x * hei, this);
  108.             }
  109.          }
  110.       }
  111.  
  112.       g.draw3DRect(1, 1, d.width - 2, d.height - 2, true);
  113.       g.draw3DRect(8, 8, d.width - 14, d.height - 14, false);
  114.       int xx = 15;
  115.       int yy = 15;
  116.       g.draw3DRect(xx - 4, yy - 4, d.width - 20, 59, true);
  117.       g.draw3DRect(xx, yy, this.bobt - 93, 51, true);
  118.       g.draw3DRect(xx + 10, yy + 10, this.bobt - 128, 30, true);
  119.       g.draw3DRect(xx + 13, yy + 13, this.bobt - 185 + 10, 24, false);
  120.       g.setColor(Color.black);
  121.       g.fillRect(xx + 14, yy + 14, this.bobt - 185 + 9, 22);
  122.       g.drawRect(9, 9, d.width - 16, d.height - 16);
  123.       g.drawRect(10, 10, d.width - 18, d.height - 18);
  124.    }
  125.  
  126.    public final synchronized void update(Graphics g) {
  127.       Dimension d = ((Component)this).size();
  128.       if (this.ghy == null || d.width != this.ghjb.width || d.height != this.ghjb.height) {
  129.          this.ghy = ((Component)this).createImage(d.width, d.height);
  130.          this.ghjb = d;
  131.          this.ghyb = this.ghy.getGraphics();
  132.       }
  133.  
  134.       this.paint(this.ghyb);
  135.       g.drawImage(this.ghy, 0, 0, (ImageObserver)null);
  136.    }
  137.  
  138.    // $FF: renamed from: XX (java.awt.Graphics) void
  139.    public void method_1(Graphics g) {
  140.       int xx = 15;
  141.       int yy = 15;
  142.       this.disptext.hyhyxx(this.hyhy[this.increase]);
  143.       ((Applet)this).showStatus("Demonstration Version from Silk Webware http://silk.webware.co.nz   " + this.bnnnn[this.increase]);
  144.    }
  145.  
  146.    public void start() {
  147.       if (this.ftxx()) {
  148.          this.allowedon = true;
  149.       }
  150.  
  151.       this.gotoURL.start();
  152.    }
  153.  
  154.    public String getAppletInfo() {
  155.       return "Name: SpinDemo1\r\n" + "Author: Nick Harrow\r\n" + "Company: Silk WebWare";
  156.    }
  157.  
  158.    // $FF: renamed from: Xx () void
  159.    public void method_2() {
  160.       this.gotourl();
  161.    }
  162.  
  163.    public void init() {
  164.       String PARAM_Number = "NumberofItems";
  165.       String param1 = ((Applet)this).getParameter(PARAM_Number);
  166.       if (param1 != null) {
  167.          this.m_Number = Integer.parseInt(param1);
  168.       }
  169.  
  170.       this.bnnn = "_blank";
  171.       String LC = "ff0000";
  172.       Color lcc = this.gogoxx(LC);
  173.       boolean M_ShowNumber = true;
  174.       boolean xzxzHex = true;
  175.       boolean M_Button = true;
  176.       int newpos = 0;
  177.       if (!M_Button) {
  178.          newpos = 60;
  179.       }
  180.  
  181.       boolean M_Bold = true;
  182.       int inbold = 0;
  183.       if (M_Bold) {
  184.          inbold = 1;
  185.       }
  186.  
  187.       this.field_0 = new Font("TimesRoman", inbold, 14);
  188.       this.bnnnn = new String[this.m_Number + 1];
  189.       this.hyhy = new String[this.m_Number + 1];
  190.  
  191.       for(int i = 0; i <= this.m_Number; ++i) {
  192.          String isregID = "Title" + i;
  193.          String isregIDhex = "Address" + i;
  194.          String param = ((Applet)this).getParameter(isregID);
  195.          String paramurl = ((Applet)this).getParameter(isregIDhex);
  196.          if (param != null) {
  197.             if (M_ShowNumber) {
  198.                this.hyhy[i] = "" + i + " " + param;
  199.             } else {
  200.                this.hyhy[i] = param;
  201.             }
  202.          } else {
  203.             this.hyhy[i] = "Not defined";
  204.          }
  205.  
  206.          if (paramurl != null) {
  207.             this.bnnnn[i] = paramurl;
  208.          }
  209.  
  210.          if (i == 4) {
  211.             this.hyhy[4] = "4 Full Version Spinalink at Silk Webware ";
  212.             this.bnnnn[4] = "http://silk.webware.co.nz";
  213.          }
  214.       }
  215.  
  216.       this.nnnn = new SpinDemo2(this, this.m_Number, xzxzHex);
  217.       ((Container)this).setLayout((LayoutManager)null);
  218.       ((Container)this).add(this.nnnn);
  219.       ((Container)this).validate();
  220.       this.gotoURL = new SpinDemo3(this, false, this.field_0, lcc);
  221.       this.disptext = new SpinDemo3(this, true, this.field_0, lcc);
  222.       ((Container)this).add(this.disptext);
  223.       this.disptext.move(30, 30);
  224.       this.bobt = ((Component)this).size().width + newpos;
  225.       this.disptext.resize(this.bobt - 185, 20);
  226.       ((Container)this).add(this.gotoURL);
  227.       ((Container)this).validate();
  228.       this.nnnn.move(this.bobt - 139, 16);
  229.       this.gotoURL.move(this.bobt - 66, 13);
  230.       if (!M_Button) {
  231.          this.gotoURL.move(this.bobt, 13);
  232.       }
  233.  
  234.       String Backgroundgraph = ((Applet)this).getParameter("BackImage");
  235.       if (Backgroundgraph != null) {
  236.          MediaTracker mt = new MediaTracker(this);
  237.          URL db = ((Applet)this).getDocumentBase();
  238.          this.field_1 = ((Applet)this).getImage(db, Backgroundgraph);
  239.          mt.addImage(this.field_1, 0);
  240.  
  241.          try {
  242.             mt.waitForID(0);
  243.          } catch (Exception var18) {
  244.             this.field_1 = null;
  245.          }
  246.       }
  247.  
  248.    }
  249.  
  250.    public void testButtonbuttonClicked(int val) {
  251.       this.increase = val;
  252.       ((Component)this).repaint();
  253.    }
  254. }
  255.