home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 June / INTERNET92.ISO / pc / software / windows / building / visual_dhtml / visualdhtmlwin9x_nt.exe / stsb.___ (.txt) < prev    next >
Encoding:
Java Class File  |  2001-10-19  |  9.4 KB  |  900 lines

  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Dimension;
  4. import java.awt.Event;
  5. import java.awt.Graphics;
  6. import java.awt.Image;
  7. import java.awt.Panel;
  8.  
  9. class stsb extends Panel implements Runnable {
  10.    public static final int SCROLL_LINE_UP = 601;
  11.    public static final int SCROLL_LINE_DOWN = 602;
  12.    public static final int SCROLL_PAGE_UP = 603;
  13.    public static final int SCROLL_PAGE_DOWN = 604;
  14.    public static final int SCROLL_ABSOLUTE = 605;
  15.    public static final int MOUSE_ENTER = 611;
  16.    public static final int MOUSE_EXIT = 612;
  17.    public static final int MOUSE_DOWN = 613;
  18.    public static final int MOUSE_UP = 614;
  19.    public int sbHeight = 0;
  20.    public int sbWidth = 0;
  21.    private int sbValue = 0;
  22.    private int pageIncrement = 0;
  23.    private int sbMax = 0;
  24.    private int sbIncrement = 1;
  25.    private Thread goauto = null;
  26.    private boolean paint_called = false;
  27.    public boolean first_run = true;
  28.    private boolean initialized = false;
  29.    private boolean bubble_hl = false;
  30.    private boolean on_top = false;
  31.    private boolean on_bottom = false;
  32.    private boolean m_down = false;
  33.    private boolean dragging_bubble = false;
  34.    private boolean bad_scroll = true;
  35.    private boolean mouse_in = false;
  36.    private boolean m_off = false;
  37.    private boolean bypass = false;
  38.    private boolean indent_bubble = false;
  39.    private Event the_e = null;
  40.    private int auto_type = 0;
  41.    // $FF: renamed from: mx int
  42.    private int field_0 = 0;
  43.    // $FF: renamed from: my int
  44.    private int field_1 = 0;
  45.    private float scrollpos;
  46.    private float lineinc;
  47.    private int drag_move = 0;
  48.    private float hbp = 0.0F;
  49.    private boolean flat = false;
  50.    private Color button_color;
  51.    private Color arrow_color;
  52.    private Color harrow_color;
  53.    private Color bg_color;
  54.    private Color slider_color;
  55.    private Color outline_color;
  56.    private Color middle_arrow_color;
  57.    private Color unactive_color;
  58.    private Color middle_arrowhl_color;
  59.    private int slider_inset;
  60.    private int last_button;
  61.    private int auto_delay;
  62.    private int auto_rate;
  63.    private int bubble_range;
  64.    private float bubble_pos;
  65.    private float oldbubble_pos;
  66.    private float bubble_inc;
  67.    private int position;
  68.    Image sboff;
  69.    private Graphics g_sboff;
  70.    private Image slider;
  71.    private Graphics g_slider;
  72.    private Image[] topb;
  73.    private Image[] botb;
  74.    private Image[] bubble;
  75.    private boolean top_graphic;
  76.    private boolean bottom_graphic;
  77.    private boolean bubble_graphic;
  78.    private Image barbg;
  79.  
  80.    public void setBarStyle(int var1, Color var2, Color var3, Color var4, Color var5, Color var6, Color var7, Color var8, Color var9, Color var10, boolean var11, boolean var12) {
  81.       this.button_color = var2;
  82.       this.arrow_color = var3;
  83.       this.harrow_color = var4;
  84.       this.bg_color = var5;
  85.       this.slider_color = var6;
  86.       this.outline_color = var7;
  87.       this.middle_arrow_color = var8;
  88.       this.unactive_color = var10;
  89.       this.middle_arrowhl_color = var9;
  90.       this.slider_inset = var1;
  91.       this.flat = var11;
  92.       this.indent_bubble = var12;
  93.    }
  94.  
  95.    public void stop() {
  96.       if (this.goauto != null) {
  97.          this.goauto.stop();
  98.          this.goauto = null;
  99.       }
  100.  
  101.    }
  102.  
  103.    public boolean mouseEnter(Event var1, int var2, int var3) {
  104.       ((Component)this).postEvent(new Event(this, 611, (Object)null));
  105.       this.mouse_in = true;
  106.       return true;
  107.    }
  108.  
  109.    public void setBarBgImage(Image var1) {
  110.       this.barbg = var1;
  111.    }
  112.  
  113.    private void initButtons() {
  114.       if (!this.top_graphic || !this.bottom_graphic || !this.bubble_graphic) {
  115.          int var1 = 0;
  116.  
  117.          do {
  118.             if (!this.top_graphic) {
  119.                this.topb[var1] = ((Component)this).createImage(this.sbWidth, this.sbWidth);
  120.             }
  121.  
  122.             if (!this.bottom_graphic) {
  123.                this.botb[var1] = ((Component)this).createImage(this.sbWidth, this.sbWidth);
  124.             }
  125.  
  126.             if (var1 < 3 && !this.bubble_graphic) {
  127.                this.bubble[var1] = ((Component)this).createImage(this.sbWidth, this.sbWidth);
  128.             }
  129.  
  130.             ++var1;
  131.          } while(var1 < 4);
  132.  
  133.          if (!this.top_graphic) {
  134.             if (this.barbg != null) {
  135.                int var2 = 0;
  136.  
  137.                do {
  138.                   Graphics var3 = this.topb[var2].getGraphics();
  139.                   var3.drawImage(this.barbg, 0, 0, this);
  140.                   ++var2;
  141.                } while(var2 < 4);
  142.             }
  143.  
  144.             Graphics var4 = this.topb[0].getGraphics();
  145.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.arrow_color, var4);
  146.             var4 = this.topb[1].getGraphics();
  147.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.harrow_color, var4);
  148.             var4 = this.topb[2].getGraphics();
  149.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 3, this.harrow_color, var4);
  150.             var4 = this.topb[3].getGraphics();
  151.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.unactive_color, var4);
  152.          }
  153.  
  154.          if (!this.bottom_graphic) {
  155.             if (this.barbg != null) {
  156.                int var17 = 0;
  157.  
  158.                do {
  159.                   Graphics var8 = this.botb[var17].getGraphics();
  160.                   var8.drawImage(this.barbg, 0, -(this.sbHeight - this.sbWidth), this);
  161.                   ++var17;
  162.                } while(var17 < 4);
  163.             }
  164.  
  165.             Graphics var9 = this.botb[0].getGraphics();
  166.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.arrow_color, var9);
  167.             var9 = this.botb[1].getGraphics();
  168.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.harrow_color, var9);
  169.             var9 = this.botb[2].getGraphics();
  170.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 4, this.harrow_color, var9);
  171.             var9 = this.botb[3].getGraphics();
  172.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.unactive_color, var9);
  173.          }
  174.  
  175.          if (!this.bubble_graphic) {
  176.             if (this.barbg != null) {
  177.                int var18 = 0;
  178.  
  179.                do {
  180.                   Graphics var13 = this.bubble[var18].getGraphics();
  181.                   var13.drawImage(this.barbg, 0, -this.sbWidth, this);
  182.                   ++var18;
  183.                } while(var18 < 3);
  184.             }
  185.  
  186.             Graphics var14 = this.bubble[0].getGraphics();
  187.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrow_color, var14);
  188.             var14 = this.bubble[1].getGraphics();
  189.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrowhl_color, var14);
  190.             var14 = this.bubble[2].getGraphics();
  191.             if (this.indent_bubble) {
  192.                this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 6, this.middle_arrowhl_color, var14);
  193.                return;
  194.             }
  195.  
  196.             this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrowhl_color, var14);
  197.          }
  198.  
  199.       }
  200.    }
  201.  
  202.    public void start() {
  203.       if (this.goauto == null) {
  204.          this.goauto = new Thread(this);
  205.          this.goauto.start();
  206.       }
  207.  
  208.    }
  209.  
  210.    public void figureBubble() {
  211.       if (this.initialized) {
  212.          this.bubble_range = this.sbHeight - this.sbWidth * 3;
  213.          this.bubble_inc = (float)this.bubble_range / (float)this.sbMax;
  214.          this.bubble_pos = (float)this.sbValue * this.bubble_inc + (float)this.sbWidth;
  215.          this.oldbubble_pos = this.bubble_pos;
  216.       }
  217.    }
  218.  
  219.    private void DrawBubble() {
  220.       if (!this.bad_scroll) {
  221.          this.drawSlider();
  222.          this.bubble_pos = this.hbp;
  223.          float var1 = (this.bubble_pos - (float)this.sbWidth) / (float)this.bubble_range;
  224.          this.sbValue = (int)(var1 * (float)this.sbMax);
  225.          this.drawButton(2, 2);
  226.       }
  227.  
  228.    }
  229.  
  230.    public Dimension preferredSize() {
  231.       return new Dimension(14, 75);
  232.    }
  233.  
  234.    private void undoHButtons() {
  235.       if (this.on_bottom) {
  236.          this.drawButton(1, 0);
  237.          this.paintIt();
  238.          this.on_bottom = false;
  239.       }
  240.  
  241.       if (this.on_top) {
  242.          this.drawButton(0, 0);
  243.          this.paintIt();
  244.          this.on_top = false;
  245.       }
  246.  
  247.       if (this.bubble_hl) {
  248.          this.drawButton(2, 0);
  249.          this.paintIt();
  250.          this.bubble_hl = false;
  251.       }
  252.  
  253.    }
  254.  
  255.    public void reshape(int var1, int var2, int var3, int var4) {
  256.       if (var3 * var4 > 0) {
  257.          this.sbWidth = var3;
  258.          this.sbHeight = var4;
  259.          this.redo();
  260.          super.reshape(var1, var2, var3, var4);
  261.       }
  262.    }
  263.  
  264.    public void setValue(int var1) {
  265.       this.scrollpos = (float)var1;
  266.       this.sbValue = (int)(Math.abs(this.scrollpos) / this.lineinc);
  267.       if (this.sbValue < 0) {
  268.          this.sbValue = 0;
  269.       }
  270.  
  271.       if (this.sbValue > this.sbMax) {
  272.          this.sbValue = this.sbMax;
  273.       }
  274.  
  275.       this.syncGraphics(0);
  276.    }
  277.  
  278.    public int getValue() {
  279.       return this.sbValue;
  280.    }
  281.  
  282.    public boolean mouseExit(Event var1, int var2, int var3) {
  283.       ((Component)this).postEvent(new Event(this, 612, (Object)null));
  284.       if (this.bad_scroll) {
  285.          return true;
  286.       } else {
  287.          this.mouse_in = false;
  288.          this.m_off = true;
  289.          this.syncGraphics(9);
  290.          return true;
  291.       }
  292.    }
  293.  
  294.    public void redo() {
  295.       this.paint_called = false;
  296.       this.first_run = true;
  297.       this.figureBubble();
  298.       this.paintIt();
  299.    }
  300.  
  301.    stsb() {
  302.       this.button_color = Color.lightGray;
  303.       this.arrow_color = Color.black;
  304.       this.harrow_color = Color.yellow;
  305.       this.bg_color = Color.white;
  306.       this.slider_color = Color.black;
  307.       this.outline_color = Color.lightGray;
  308.       this.middle_arrow_color = Color.lightGray;
  309.       this.unactive_color = Color.lightGray;
  310.       this.middle_arrowhl_color = Color.lightGray;
  311.       this.slider_inset = 0;
  312.       this.last_button = 0;
  313.       this.auto_delay = 5;
  314.       this.auto_rate = 40;
  315.       this.bubble_range = 0;
  316.       this.bubble_pos = 0.0F;
  317.       this.oldbubble_pos = 0.0F;
  318.       this.bubble_inc = 0.0F;
  319.       this.position = 0;
  320.       this.sboff = null;
  321.       this.g_sboff = null;
  322.       this.topb = new Image[4];
  323.       this.botb = new Image[4];
  324.       this.bubble = new Image[3];
  325.       this.top_graphic = false;
  326.       this.bottom_graphic = false;
  327.       this.bubble_graphic = false;
  328.    }
  329.  
  330.    public void paint(Graphics var1) {
  331.       this.paint_called = true;
  332.       this.paintIt();
  333.    }
  334.  
  335.    public boolean mouseUp(Event var1, int var2, int var3) {
  336.       if (this.bad_scroll) {
  337.          ((Component)this).postEvent(new Event(this, 614, (Object)null));
  338.          return true;
  339.       } else {
  340.          this.m_down = false;
  341.          if (this.dragging_bubble) {
  342.             this.dragging_bubble = false;
  343.             if (var2 >= 0 && var2 <= this.sbWidth && (float)var3 >= this.bubble_pos && (float)var3 < this.bubble_pos + (float)this.sbWidth) {
  344.                this.drawButton(2, 1);
  345.                this.paintIt();
  346.             }
  347.          }
  348.  
  349.          this.last_button = 0;
  350.          this.stop();
  351.          this.auto_type = 0;
  352.          if (this.m_off) {
  353.             this.syncGraphics(8);
  354.             ((Component)this).postEvent(new Event(this, 614, (Object)null));
  355.             return true;
  356.          } else if (this.on_bottom) {
  357.             this.syncGraphics(10);
  358.             ((Component)this).postEvent(new Event(this, 614, (Object)null));
  359.             return true;
  360.          } else if (this.on_top) {
  361.             this.syncGraphics(11);
  362.             ((Component)this).postEvent(new Event(this, 614, (Object)null));
  363.             return true;
  364.          } else {
  365.             ((Component)this).postEvent(new Event(this, 614, (Object)null));
  366.             return true;
  367.          }
  368.       }
  369.    }
  370.  
  371.    private synchronized void syncGraphics(int var1) {
  372.       if (var1 == 0) {
  373.          if (!this.bad_scroll) {
  374.             this.drawSlider();
  375.             this.drawButton(2, 0);
  376.             this.drawButton(0, 0);
  377.             this.drawButton(1, 0);
  378.          } else {
  379.             this.drawSlider();
  380.             this.drawButton(0, 3);
  381.             this.drawButton(1, 3);
  382.          }
  383.  
  384.          this.paintIt();
  385.       } else if (var1 == 3) {
  386.          this.drawButton(1, 2);
  387.       } else if (var1 == 4) {
  388.          this.drawButton(0, 2);
  389.       } else if (var1 == 5) {
  390.          this.drawSlider();
  391.          this.bubble_pos = (float)this.sbValue * this.bubble_inc + (float)this.sbWidth;
  392.          this.drawButton(2, 0);
  393.          this.paintIt();
  394.       } else if (var1 == 6) {
  395.          this.DrawBubble();
  396.          this.paintIt();
  397.       } else if (var1 == 7) {
  398.          this.drawButton(1, 0);
  399.          this.on_bottom = false;
  400.          this.drawButton(0, 0);
  401.          this.on_top = false;
  402.          this.stop();
  403.          this.auto_type = 0;
  404.          this.paintIt();
  405.       } else if (var1 == 8) {
  406.          this.drawButton(1, 0);
  407.          this.drawButton(0, 0);
  408.          this.paintIt();
  409.          this.on_bottom = false;
  410.          this.on_top = false;
  411.          this.m_off = false;
  412.       } else if (var1 == 9) {
  413.          this.undoHButtons();
  414.       } else if (var1 == 10) {
  415.          this.drawButton(1, 1);
  416.          this.paintIt();
  417.       } else if (var1 == 11) {
  418.          this.drawButton(0, 1);
  419.          this.paintIt();
  420.       } else {
  421.          if (var1 == 12) {
  422.             this.initDrawScrollBar();
  423.          }
  424.  
  425.       }
  426.    }
  427.  
  428.    private synchronized void paintIt() {
  429.       if (this.paint_called && this.sbWidth != 0 && this.sbHeight != 0) {
  430.          ((Component)this).getGraphics();
  431.          if (this.first_run) {
  432.             ((Component)this).setBackground(this.bg_color);
  433.             if (this.sbWidth * this.sbHeight > 0) {
  434.                this.sboff = ((Component)this).createImage(this.sbWidth, this.sbHeight);
  435.                this.g_sboff = this.sboff.getGraphics();
  436.                this.syncGraphics(12);
  437.                this.first_run = false;
  438.             }
  439.          } else {
  440.             ((Component)this).getGraphics().drawImage(this.sboff, 0, 0, this);
  441.          }
  442.       }
  443.    }
  444.  
  445.    public void setValues(int var1, int var2, int var3, int var4) {
  446.       this.scrollpos = (float)var4;
  447.       this.lineinc = (float)var1;
  448.       this.sbIncrement = var1;
  449.       this.pageIncrement = var2;
  450.       this.sbMax = var3 - var2;
  451.       this.sbValue = var4;
  452.       this.bubble_pos = 0.0F;
  453.       if (this.sbMax < 1) {
  454.          this.bad_scroll = true;
  455.          this.bubble_pos = (float)this.sbWidth;
  456.       } else {
  457.          this.bad_scroll = false;
  458.       }
  459.  
  460.       this.initialized = true;
  461.       this.figureBubble();
  462.       this.paintIt();
  463.       this.syncGraphics(0);
  464.    }
  465.  
  466.    public void resize(int var1, int var2) {
  467.       if (var1 * var2 > 0) {
  468.          this.sbWidth = var1;
  469.          this.sbHeight = var2;
  470.          this.redo();
  471.          super.resize(var1, var2);
  472.       }
  473.    }
  474.  
  475.    public void resize(Dimension var1) {
  476.       if (var1.width * var1.height > 0) {
  477.          this.sbWidth = var1.width;
  478.          this.sbHeight = var1.height;
  479.          this.redo();
  480.          super.resize(var1);
  481.       }
  482.    }
  483.  
  484.    private void initDrawScrollBar() {
  485.       this.g_sboff.setColor(this.bg_color);
  486.       this.g_sboff.fillRect(0, 0, this.sbWidth, this.sbHeight);
  487.       int var1 = this.sbHeight - this.sbWidth * 2;
  488.       this.slider = ((Component)this).createImage(this.sbWidth, var1);
  489.       this.g_slider = this.slider.getGraphics();
  490.       if (this.barbg != null) {
  491.          this.g_slider.drawImage(this.barbg, 0, -this.sbWidth, this);
  492.       }
  493.  
  494.       if (this.slider_color != null) {
  495.          this.g_slider.setColor(this.slider_color);
  496.          this.g_slider.fillRect(this.slider_inset, 0, this.sbWidth - (this.slider_inset * 2 + 1), var1);
  497.       }
  498.  
  499.       if (this.outline_color != null) {
  500.          this.g_slider.setColor(this.outline_color);
  501.          this.g_slider.drawLine(this.slider_inset, 0, this.slider_inset, var1);
  502.          this.g_slider.drawLine(this.sbWidth - (this.slider_inset + 1), 0, this.sbWidth - (this.slider_inset + 1), var1);
  503.       }
  504.  
  505.       this.drawSlider();
  506.       this.initButtons();
  507.       if (!this.bad_scroll) {
  508.          this.drawButton(0, 0);
  509.          this.drawButton(1, 0);
  510.          this.drawButton(2, 0);
  511.       } else {
  512.          this.drawButton(0, 3);
  513.          this.drawButton(1, 3);
  514.       }
  515.  
  516.       ((Component)this).getGraphics().drawImage(this.sboff, 0, 0, this);
  517.    }
  518.  
  519.    private void initDrawButtons(int var1, int var2, int var3, int var4, int var5, Color var6, Graphics var7) {
  520.       if (this.button_color != null) {
  521.          var7.setColor(this.button_color);
  522.          var7.fillRect(var1, var2, var3 + 1, var4 + 1);
  523.       }
  524.  
  525.       if (this.flat && this.outline_color != null) {
  526.          var7.setColor(this.outline_color);
  527.          var7.drawRect(var1, var2, var3 - 1, var4 - 1);
  528.       }
  529.  
  530.       if (var5 > 0 && var6 != null) {
  531.          var7.setColor(var6);
  532.          int var8 = 0;
  533.          int var9 = 0;
  534.          int var10 = 0;
  535.          if (var3 < 10) {
  536.             var8 = 2;
  537.          } else if (var3 < 14) {
  538.             var8 = 4;
  539.          } else if (var3 < 17) {
  540.             var8 = 6;
  541.          } else {
  542.             var8 = 8;
  543.          }
  544.  
  545.          int var11 = var8 + 1;
  546.          int var12 = var8 / 2 + 1;
  547.          int var13 = (int)((float)var3 / 2.0F - (float)var11 / 2.0F);
  548.          int var14 = (int)((float)var4 / 2.0F - (float)var12 / 2.0F);
  549.          if (var5 == 1 || var5 == 3) {
  550.             var14 = var4 - var14 - 1;
  551.          }
  552.  
  553.          if (var5 == 5 || var5 == 6) {
  554.             var8 -= 2;
  555.             var11 = var8 + 1;
  556.             var13 = (int)((float)var3 / 2.0F - (float)var11 / 2.0F);
  557.             var14 = var4 / 2 + 1;
  558.             var9 = var13;
  559.             var10 = var14 - 3;
  560.          }
  561.  
  562.          if (var5 == 3 || var5 == 4) {
  563.             ++var13;
  564.             ++var14;
  565.          }
  566.  
  567.          if (var5 == 6) {
  568.             ++var14;
  569.             ++var10;
  570.          }
  571.  
  572.          if (var5 != 5 && var5 != 6) {
  573.             for(int var19 = var8; var19 >= 0; var19 -= 2) {
  574.                var7.drawLine(var13, var14, var13 + var19, var14);
  575.                ++var13;
  576.                if (var5 != 2 && var5 != 4) {
  577.                   --var14;
  578.                } else {
  579.                   ++var14;
  580.                }
  581.             }
  582.          } else {
  583.             int var15 = 0;
  584.  
  585.             do {
  586.                for(int var16 = var8; var16 >= 0; var16 -= 2) {
  587.                   var7.drawLine(var13, var14, var13 + var16, var14);
  588.                   ++var13;
  589.                   if (var15 == 0) {
  590.                      ++var14;
  591.                   } else {
  592.                      --var14;
  593.                   }
  594.                }
  595.  
  596.                var13 = var9;
  597.                var14 = var10;
  598.                ++var15;
  599.             } while(var15 < 2);
  600.          }
  601.       }
  602.  
  603.       if (!this.flat) {
  604.          if (var5 == 0 || var5 == 1 || var5 == 2 || var5 == 5) {
  605.             var7.setColor(Color.lightGray);
  606.             var7.drawRect(0, 0, var3 - 1, var4 - 1);
  607.             var7.setColor(Color.black);
  608.             var7.drawLine(0, var4 - 1, var3 - 1, var4 - 1);
  609.             var7.drawLine(var3 - 1, 0, var3 - 1, var4 - 1);
  610.             var7.setColor(Color.white);
  611.             var7.drawRect(1, 1, var3 - 3, var4 - 3);
  612.             var7.setColor(Color.gray);
  613.             var7.drawLine(1, var4 - 2, var3 - 2, var4 - 2);
  614.             var7.drawLine(var3 - 2, 1, var3 - 2, var4 - 2);
  615.             return;
  616.          }
  617.  
  618.          if (var5 == 6) {
  619.             var7.setColor(Color.white);
  620.             var7.drawRect(0, 0, var3 - 1, var4 - 1);
  621.             var7.setColor(Color.black);
  622.             var7.drawLine(0, var4 - 1, var3 - 1, var4 - 1);
  623.             var7.drawLine(var3 - 1, 0, var3 - 1, var4 - 1);
  624.             return;
  625.          }
  626.  
  627.          var7.setColor(Color.gray);
  628.          var7.drawRect(var1, var2, var3 - 1, var4 - 1);
  629.       }
  630.  
  631.    }
  632.  
  633.    private void drawButton(int var1, int var2) {
  634.       if (var1 == 0) {
  635.          if (this.topb[var2] != null) {
  636.             this.g_sboff.drawImage(this.topb[var2], 0, 0, this);
  637.             return;
  638.          }
  639.       } else if (var1 == 1) {
  640.          if (this.botb[var2] != null) {
  641.             this.g_sboff.drawImage(this.botb[var2], 0, this.sbHeight - this.sbWidth, this);
  642.             return;
  643.          }
  644.       } else if (var1 == 2 && this.bubble[var2] != null) {
  645.          this.g_sboff.drawImage(this.bubble[var2], 0, (int)this.bubble_pos, this);
  646.       }
  647.  
  648.    }
  649.  
  650.    private void checkDbutton(Event var1, int var2) {
  651.       if (var2 == 1) {
  652.          this.sbValue += this.sbIncrement;
  653.          if (this.sbValue > this.sbMax) {
  654.             this.sbValue = this.sbMax;
  655.          }
  656.  
  657.          this.syncGraphics(5);
  658.          var1.id = 602;
  659.          ((Component)this).postEvent(var1);
  660.       } else if (var2 == 2) {
  661.          this.sbValue -= this.sbIncrement;
  662.          if (this.sbValue < 0) {
  663.             this.sbValue = 0;
  664.          }
  665.  
  666.          this.syncGraphics(5);
  667.          var1.id = 601;
  668.          ((Component)this).postEvent(var1);
  669.       } else if (var2 == 3) {
  670.          this.sbValue -= this.pageIncrement;
  671.          if (this.sbValue < 0) {
  672.             this.sbValue = 0;
  673.          }
  674.  
  675.          this.syncGraphics(5);
  676.          var1.id = 603;
  677.          ((Component)this).postEvent(var1);
  678.       } else {
  679.          if (var2 == 4) {
  680.             this.sbValue += this.pageIncrement;
  681.             if (this.sbValue > this.sbMax) {
  682.                this.sbValue = this.sbMax;
  683.             }
  684.  
  685.             this.syncGraphics(5);
  686.             var1.id = 604;
  687.             ((Component)this).postEvent(var1);
  688.          }
  689.  
  690.       }
  691.    }
  692.  
  693.    private void drawSlider() {
  694.       if (this.slider != null) {
  695.          this.g_sboff.drawImage(this.slider, 0, this.sbWidth, this);
  696.       }
  697.  
  698.    }
  699.  
  700.    public boolean mouseDown(Event var1, int var2, int var3) {
  701.       ((Component)this).postEvent(new Event(this, 613, (Object)null));
  702.       this.m_down = true;
  703.       if (this.bad_scroll) {
  704.          return true;
  705.       } else if (this.on_bottom) {
  706.          this.syncGraphics(3);
  707.          this.last_button = 1;
  708.          this.auto_type = 1;
  709.          this.checkDbutton(var1, this.auto_type);
  710.          this.the_e = var1;
  711.          this.start();
  712.          return true;
  713.       } else if (this.on_top) {
  714.          this.syncGraphics(4);
  715.          this.last_button = 2;
  716.          this.auto_type = 2;
  717.          this.checkDbutton(var1, this.auto_type);
  718.          this.the_e = var1;
  719.          this.start();
  720.          return true;
  721.       } else {
  722.          if (var2 >= 0 && var2 <= this.sbWidth) {
  723.             if ((float)var3 >= this.bubble_pos && (float)var3 < this.bubble_pos + (float)this.sbWidth) {
  724.                this.drawButton(2, 2);
  725.                this.paintIt();
  726.                this.dragging_bubble = true;
  727.                this.drag_move = var3;
  728.                return true;
  729.             }
  730.  
  731.             if ((float)var3 < this.bubble_pos) {
  732.                this.field_1 = var3;
  733.                this.field_0 = var2;
  734.                this.auto_type = 3;
  735.                this.checkDbutton(var1, this.auto_type);
  736.                this.the_e = var1;
  737.                this.start();
  738.             } else {
  739.                this.field_1 = var3;
  740.                this.field_0 = var2;
  741.                this.auto_type = 4;
  742.                this.checkDbutton(var1, this.auto_type);
  743.                this.the_e = var1;
  744.                this.start();
  745.             }
  746.          }
  747.  
  748.          return true;
  749.       }
  750.    }
  751.  
  752.    public void setBarButtonImages(Image[] var1, Image[] var2, Image[] var3) {
  753.       if (var1 != null) {
  754.          this.topb = var1;
  755.          this.top_graphic = true;
  756.       }
  757.  
  758.       if (var2 != null) {
  759.          this.botb = var2;
  760.          this.bottom_graphic = true;
  761.       }
  762.  
  763.       if (this.bubble != null) {
  764.          this.bubble = var3;
  765.          this.bubble_graphic = true;
  766.       }
  767.  
  768.    }
  769.  
  770.    private boolean cButtons(int var1) {
  771.       if (var1 < this.sbWidth && var1 >= 0) {
  772.          if (!this.on_top) {
  773.             this.undoHButtons();
  774.             this.on_top = true;
  775.             if (!this.m_down) {
  776.                this.drawButton(0, 1);
  777.             } else if (this.last_button != 1) {
  778.                this.drawButton(0, 1);
  779.                this.bypass = true;
  780.                this.auto_type = 2;
  781.                this.start();
  782.             } else {
  783.                this.on_top = false;
  784.             }
  785.  
  786.             this.paintIt();
  787.          }
  788.  
  789.          return true;
  790.       } else if (var1 > this.sbHeight - this.sbWidth && var1 <= this.sbHeight) {
  791.          if (!this.on_bottom) {
  792.             this.undoHButtons();
  793.             this.on_bottom = true;
  794.             if (!this.m_down) {
  795.                this.drawButton(1, 1);
  796.             } else if (this.last_button != 2) {
  797.                this.drawButton(1, 1);
  798.                this.bypass = true;
  799.                this.auto_type = 1;
  800.                this.start();
  801.             } else {
  802.                this.on_bottom = false;
  803.             }
  804.  
  805.             this.paintIt();
  806.          }
  807.  
  808.          return true;
  809.       } else if ((float)var1 >= this.bubble_pos && (float)var1 < this.bubble_pos + (float)this.sbWidth) {
  810.          if (!this.bubble_hl) {
  811.             this.undoHButtons();
  812.             this.drawButton(2, 1);
  813.             this.paintIt();
  814.             this.bubble_hl = true;
  815.          }
  816.  
  817.          return true;
  818.       } else {
  819.          return false;
  820.       }
  821.    }
  822.  
  823.    public void run() {
  824.       while(true) {
  825.          if (!this.bypass) {
  826.             try {
  827.                Thread.sleep((long)(this.auto_delay * 100));
  828.             } catch (InterruptedException var2) {
  829.             }
  830.          } else {
  831.             this.bypass = false;
  832.          }
  833.  
  834.          while(this.m_down) {
  835.             if (this.auto_type != 3 && this.auto_type != 4 || this.field_0 > 0 && this.field_0 < this.sbWidth && this.field_1 <= this.sbHeight - this.sbWidth && this.field_1 >= this.sbWidth && (this.auto_type != 3 || !((float)this.field_1 > this.bubble_pos)) && (this.auto_type != 4 || !((float)this.field_1 < this.bubble_pos + (float)this.sbWidth))) {
  836.                this.checkDbutton(this.the_e, this.auto_type);
  837.  
  838.                try {
  839.                   Thread.sleep((long)this.auto_rate);
  840.                } catch (InterruptedException var1) {
  841.                }
  842.             }
  843.          }
  844.       }
  845.    }
  846.  
  847.    public boolean mouseDrag(Event var1, int var2, int var3) {
  848.       this.field_0 = var2;
  849.       this.field_1 = var3;
  850.       if (this.bad_scroll) {
  851.          return true;
  852.       } else {
  853.          if (this.dragging_bubble) {
  854.             if (this.drag_move != var3) {
  855.                this.hbp = this.bubble_pos + (float)(var3 - this.drag_move);
  856.                if (this.hbp > (float)(this.bubble_range + this.sbWidth)) {
  857.                   this.hbp = (float)(this.bubble_range + this.sbWidth);
  858.                }
  859.  
  860.                if (this.hbp < (float)this.sbWidth) {
  861.                   this.hbp = (float)this.sbWidth;
  862.                }
  863.  
  864.                this.syncGraphics(6);
  865.                var1.id = 605;
  866.                ((Component)this).postEvent(var1);
  867.                this.drag_move = var3;
  868.             }
  869.          } else {
  870.             if (this.auto_type > 2) {
  871.                return true;
  872.             }
  873.  
  874.             if (var2 > 0 && var2 < this.sbWidth && this.cButtons(var3)) {
  875.                this.m_off = false;
  876.                return true;
  877.             }
  878.  
  879.             this.m_off = true;
  880.             this.syncGraphics(7);
  881.          }
  882.  
  883.          return true;
  884.       }
  885.    }
  886.  
  887.    public boolean mouseMove(Event var1, int var2, int var3) {
  888.       if (!this.m_down && !this.bad_scroll) {
  889.          if (this.cButtons(var3)) {
  890.             return true;
  891.          } else {
  892.             this.syncGraphics(9);
  893.             return true;
  894.          }
  895.       } else {
  896.          return true;
  897.       }
  898.    }
  899. }
  900.