home *** CD-ROM | disk | FTP | other *** search
- package hhapplet;
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.image.ImageObserver;
- import java.util.Vector;
-
- public class BsscImagePanel extends Panel implements Runnable {
- private Image m_bgImage;
- private int m_nbgWidth;
- private int m_nbgHeight;
- private Image m_cachebgImage;
- private int m_nOldWidth;
- private int m_nOldHeight;
- private boolean m_bBgUpdated;
- private Image m_imgbackground;
- private Vector m_vToDo;
-
- private Image getBackgroundImage() {
- if (this.m_nbgWidth > 0 && this.m_nbgHeight > 0 && this.m_bgImage != null) {
- Rectangle var1 = ((Component)this).getBounds();
- if (var1.height == this.m_nOldHeight && var1.width == this.m_nOldWidth && !this.m_bBgUpdated) {
- return this.m_cachebgImage;
- } else {
- this.m_nOldWidth = var1.width;
- this.m_nOldHeight = var1.height;
- this.m_cachebgImage = ((Component)this).createImage(var1.width, var1.height);
- Graphics var2 = this.m_cachebgImage.getGraphics();
- this.drawBackGround(var2);
- return this.m_cachebgImage;
- }
- } else {
- return null;
- }
- }
-
- public BsscImagePanel() {
- if (ViewSkin.m_PaneColorBg != null) {
- ((Component)this).setBackground(ViewSkin.m_PaneColorBg);
- }
-
- if (ViewSkin.m_PaneImageBg != null) {
- this.setBgImage(ViewSkin.m_PaneImageBg);
- }
-
- this.m_vToDo = new Vector();
- }
-
- public void paint(Graphics var1) {
- try {
- super.paint(var1);
- Rectangle var2 = ((Component)this).getBounds();
- Image var3 = ((Component)this).createImage(var2.width, var2.height);
- Graphics var4 = var3.getGraphics();
- this.m_imgbackground = this.getBackgroundImage();
- if (this.m_imgbackground != null) {
- var4.drawImage(this.m_imgbackground, 0, 0, this);
- }
-
- var1.drawImage(var3, 0, 0, this);
- } catch (Exception var5) {
- ((Throwable)var5).printStackTrace();
- }
- }
-
- public void setBgImage(Image var1) {
- this.m_bgImage = var1;
- this.m_nbgHeight = this.m_bgImage.getHeight(this);
- this.m_nbgWidth = this.m_bgImage.getWidth(this);
- }
-
- public void dispatchToDo(String var1) {
- if (var1 == "repaint") {
- ((Component)this).repaint();
- }
-
- }
-
- public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- if (var1 == this.m_bgImage) {
- this.m_nbgWidth = var5;
- this.m_nbgHeight = var6;
- this.m_bBgUpdated = true;
- ((Component)this).repaint();
- return false;
- } else {
- return true;
- }
- }
-
- public void drawBackGround(Graphics var1) {
- if (this.m_nbgWidth > 0 && this.m_nbgHeight > 0 && this.m_bgImage != null) {
- Rectangle var5 = ((Component)this).getBounds();
-
- for(int var6 = 0; var6 <= (var5.width - 1) / this.m_nbgWidth; ++var6) {
- for(int var7 = 0; var7 <= (var5.height - 1) / this.m_nbgHeight; ++var7) {
- if (!var1.drawImage(this.m_bgImage, var6 * this.m_nbgWidth, var7 * this.m_nbgHeight, this.m_nbgWidth, this.m_nbgHeight, (ImageObserver)null)) {
- this.setTimeout("repaint", 100);
- return;
- }
- }
- }
-
- if (this.m_bBgUpdated) {
- this.m_bBgUpdated = false;
- return;
- }
- } else {
- Color var2 = var1.getColor();
- Color var3 = ((Component)this).getBackground();
- var1.setColor(var3);
- Rectangle var4 = ((Component)this).getBounds();
- var1.fillRect(0, 0, var4.width, var4.height);
- var1.setColor(var2);
- }
-
- }
-
- public void update(Graphics var1) {
- this.paint(var1);
- }
-
- public void run() {
- synchronized(this.m_vToDo){}
-
- ToDo var1;
- try {
- var1 = (ToDo)this.m_vToDo.elementAt(0);
- this.m_vToDo.removeElementAt(0);
- } catch (Throwable var8) {
- throw var8;
- }
-
- try {
- Thread.sleep((long)var1.m_nMSec);
- this.dispatchToDo(var1.m_sToDo);
- } catch (InterruptedException var7) {
- ((Throwable)var7).printStackTrace();
- }
- }
-
- public final void setTimeout(String var1, int var2) {
- ToDo var3 = new ToDo(this, var1, var2);
- synchronized(this.m_vToDo){}
-
- try {
- this.m_vToDo.addElement(var3);
- } catch (Throwable var8) {
- throw var8;
- }
-
- Thread var4 = new Thread(this);
- var4.start();
- }
- }
-