home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Panel; class stsbimg { private boolean bubble_hl = false; private boolean on_top = false; private boolean on_bottom = false; private boolean m_down = false; private boolean dragging_bubble = false; private boolean bad_scroll = true; private boolean mouse_in = false; private boolean m_off = false; private boolean bypass = false; private boolean indent_bubble = false; private float hbp = 0.0F; private boolean flat = false; private Color button_color; private Color arrow_color; private Color harrow_color; private Color bg_color; private Color slider_color; private Color outline_color; private Color middle_arrow_color; private Color unactive_color; private Color middle_arrowhl_color; private int slider_inset; private int last_button; private int auto_delay; private int auto_rate; private int bubble_range; private float bubble_pos; private float oldbubble_pos; private float bubble_inc; private int position; Image sboff; private Graphics g_sboff; private Image slider; private Graphics g_slider; private Image[] topb; private Image[] botb; private Image[] bubble; private boolean top_graphic; private boolean bottom_graphic; private boolean bubble_graphic; private Image barbg; Panel gcomp; int sbWidth; int sbHeight; public void setBarBgImage(Image var1) { this.barbg = var1; } stsbimg(Panel var1, int var2, int var3) { this.button_color = Color.lightGray; this.arrow_color = Color.black; this.harrow_color = Color.yellow; this.bg_color = Color.white; this.slider_color = Color.black; this.outline_color = Color.lightGray; this.middle_arrow_color = Color.lightGray; this.unactive_color = Color.lightGray; this.middle_arrowhl_color = Color.lightGray; this.slider_inset = 0; this.last_button = 0; this.auto_delay = 5; this.auto_rate = 40; this.bubble_range = 0; this.bubble_pos = 0.0F; this.oldbubble_pos = 0.0F; this.bubble_inc = 0.0F; this.position = 0; this.sboff = null; this.g_sboff = null; this.topb = new Image[4]; this.botb = new Image[4]; this.bubble = new Image[3]; this.top_graphic = false; this.bottom_graphic = false; this.bubble_graphic = false; this.gcomp = var1; this.sbWidth = var2; this.sbHeight = var3; } private void initButtons() { if (!this.top_graphic || !this.bottom_graphic || !this.bubble_graphic) { int var1 = 0; do { if (!this.top_graphic) { this.topb[var1] = this.gcomp.createImage(this.sbWidth, this.sbWidth); } if (!this.bottom_graphic) { this.botb[var1] = this.gcomp.createImage(this.sbWidth, this.sbWidth); } if (var1 < 3 && !this.bubble_graphic) { this.bubble[var1] = this.gcomp.createImage(this.sbWidth, this.sbWidth); } ++var1; } while(var1 < 4); if (!this.top_graphic) { if (this.barbg != null) { int var20 = 0; do { Graphics var4 = this.topb[var20].getGraphics(); var4.drawImage(this.barbg, 0, 0, this.gcomp); ++var20; } while(var20 < 4); } else if (this.bg_color != null) { int var2 = 0; do { Graphics var3 = this.topb[var2].getGraphics(); var3.setColor(this.bg_color); var3.fillRect(0, 0, this.sbWidth, this.sbWidth); ++var2; } while(var2 < 4); } Graphics var5 = this.topb[0].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.arrow_color, var5); var5 = this.topb[1].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.harrow_color, var5); var5 = this.topb[2].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 3, this.harrow_color, var5); var5 = this.topb[3].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 1, this.unactive_color, var5); } if (!this.bottom_graphic) { if (this.barbg != null) { int var22 = 0; do { Graphics var10 = this.botb[var22].getGraphics(); var10.drawImage(this.barbg, 0, -(this.sbHeight - this.sbWidth), this.gcomp); ++var22; } while(var22 < 4); } else if (this.bg_color != null) { int var21 = 0; do { Graphics var9 = this.botb[var21].getGraphics(); var9.setColor(this.bg_color); var9.fillRect(0, 0, this.sbWidth, this.sbWidth); ++var21; } while(var21 < 4); } Graphics var11 = this.botb[0].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.arrow_color, var11); var11 = this.botb[1].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.harrow_color, var11); var11 = this.botb[2].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 4, this.harrow_color, var11); var11 = this.botb[3].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 2, this.unactive_color, var11); } if (!this.bubble_graphic) { if (this.barbg != null) { int var24 = 0; do { Graphics var16 = this.bubble[var24].getGraphics(); var16.drawImage(this.barbg, 0, -this.sbWidth, this.gcomp); ++var24; } while(var24 < 3); } else if (this.bg_color != null) { int var23 = 0; do { Graphics var15 = this.bubble[var23].getGraphics(); var15.setColor(this.bg_color); var15.fillRect(0, 0, this.sbWidth, this.sbWidth); ++var23; } while(var23 < 3); } Graphics var17 = this.bubble[0].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrow_color, var17); var17 = this.bubble[1].getGraphics(); this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrowhl_color, var17); var17 = this.bubble[2].getGraphics(); if (this.indent_bubble) { this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 6, this.middle_arrowhl_color, var17); return; } this.initDrawButtons(0, 0, this.sbWidth, this.sbWidth, 5, this.middle_arrowhl_color, var17); } } } public Image getSBImage() { if (this.sbWidth >= 1 && this.sbHeight >= 1) { this.sboff = this.gcomp.createImage(this.sbWidth, this.sbHeight); this.g_sboff = this.sboff.getGraphics(); this.initDrawScrollBar(); return this.sboff; } else { return null; } } private void initDrawScrollBar() { this.g_sboff.setColor(this.bg_color); this.g_sboff.fillRect(0, 0, this.sbWidth, this.sbHeight); int var1 = this.sbHeight - this.sbWidth * 2; this.slider = this.gcomp.createImage(this.sbWidth, var1); this.g_slider = this.slider.getGraphics(); this.g_slider.setColor(this.bg_color); this.g_slider.fillRect(0, 0, this.sbWidth, var1); if (this.barbg != null) { this.g_slider.drawImage(this.barbg, 0, -this.sbWidth, this.gcomp); } if (this.slider_color != null) { this.g_slider.setColor(this.slider_color); this.g_slider.fillRect(this.slider_inset, 0, this.sbWidth - (this.slider_inset * 2 + 1), var1); } if (this.outline_color != null) { this.g_slider.setColor(this.outline_color); this.g_slider.drawLine(this.slider_inset, 0, this.slider_inset, var1); this.g_slider.drawLine(this.sbWidth - (this.slider_inset + 1), 0, this.sbWidth - (this.slider_inset + 1), var1); } this.drawSlider(); this.initButtons(); this.drawButton(0, 0); this.drawButton(1, 0); this.drawButton(2, 0); } private void initDrawButtons(int var1, int var2, int var3, int var4, int var5, Color var6, Graphics var7) { if (this.button_color != null) { var7.setColor(this.button_color); var7.fillRect(var1, var2, var3 + 1, var4 + 1); } if (this.flat && this.outline_color != null) { var7.setColor(this.outline_color); var7.drawRect(var1, var2, var3 - 1, var4 - 1); } if (var5 > 0 && var6 != null) { var7.setColor(var6); int var8 = 0; int var9 = 0; int var10 = 0; if (var3 < 10) { var8 = 2; } else if (var3 < 14) { var8 = 4; } else if (var3 < 17) { var8 = 6; } else { var8 = 8; } int var11 = var8 + 1; int var12 = var8 / 2 + 1; int var13 = (int)((float)var3 / 2.0F - (float)var11 / 2.0F); int var14 = (int)((float)var4 / 2.0F - (float)var12 / 2.0F); if (var5 == 1 || var5 == 3) { var14 = var4 - var14 - 1; } if (var5 == 5 || var5 == 6) { var8 -= 2; var11 = var8 + 1; var13 = (int)((float)var3 / 2.0F - (float)var11 / 2.0F); var14 = var4 / 2 + 1; var9 = var13; var10 = var14 - 3; } if (var5 == 3 || var5 == 4) { ++var13; ++var14; } if (var5 == 6) { ++var14; ++var10; } if (var5 != 5 && var5 != 6) { for(int var19 = var8; var19 >= 0; var19 -= 2) { var7.drawLine(var13, var14, var13 + var19, var14); ++var13; if (var5 != 2 && var5 != 4) { --var14; } else { ++var14; } } } else { int var15 = 0; do { for(int var16 = var8; var16 >= 0; var16 -= 2) { var7.drawLine(var13, var14, var13 + var16, var14); ++var13; if (var15 == 0) { ++var14; } else { --var14; } } var13 = var9; var14 = var10; ++var15; } while(var15 < 2); } } if (!this.flat) { if (var5 == 0 || var5 == 1 || var5 == 2 || var5 == 5) { var7.setColor(Color.lightGray); var7.drawRect(0, 0, var3 - 1, var4 - 1); var7.setColor(Color.black); var7.drawLine(0, var4 - 1, var3 - 1, var4 - 1); var7.drawLine(var3 - 1, 0, var3 - 1, var4 - 1); var7.setColor(Color.white); var7.drawRect(1, 1, var3 - 3, var4 - 3); var7.setColor(Color.gray); var7.drawLine(1, var4 - 2, var3 - 2, var4 - 2); var7.drawLine(var3 - 2, 1, var3 - 2, var4 - 2); return; } if (var5 == 6) { var7.setColor(Color.white); var7.drawRect(0, 0, var3 - 1, var4 - 1); var7.setColor(Color.black); var7.drawLine(0, var4 - 1, var3 - 1, var4 - 1); var7.drawLine(var3 - 1, 0, var3 - 1, var4 - 1); return; } var7.setColor(Color.gray); var7.drawRect(var1, var2, var3 - 1, var4 - 1); } } private void drawButton(int var1, int var2) { if (var1 == 0) { if (this.topb[var2] != null) { this.g_sboff.drawImage(this.topb[var2], 0, 0, this.gcomp); return; } } else if (var1 == 1) { if (this.botb[var2] != null) { this.g_sboff.drawImage(this.botb[var2], 0, this.sbHeight - this.sbWidth, this.gcomp); return; } } else if (var1 == 2 && this.bubble[var2] != null) { this.g_sboff.drawImage(this.bubble[var2], 0, this.sbWidth, this.gcomp); } } private void drawSlider() { if (this.slider != null) { this.g_sboff.drawImage(this.slider, 0, this.sbWidth, this.gcomp); } } public void setBarButtonImages(Image[] var1, Image[] var2, Image[] var3) { if (var1 != null) { this.topb = var1; this.top_graphic = true; } if (var2 != null) { this.botb = var2; this.bottom_graphic = true; } if (this.bubble != null) { this.bubble = var3; this.bubble_graphic = true; } } 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) { this.button_color = var2; this.arrow_color = var3; this.harrow_color = var4; this.bg_color = var5; this.slider_color = var6; this.outline_color = var7; this.middle_arrow_color = var8; this.unactive_color = var10; this.middle_arrowhl_color = var9; this.slider_inset = var1; this.flat = var11; this.indent_bubble = var12; } }