home *** CD-ROM | disk | FTP | other *** search
/ Your Web Site Creator / Your Web Site Creator.iso / WebSite / data1.cab / Program_Executable_Files / Classes / BORDER2.CLA (.txt) < prev    next >
Encoding:
Java Class File  |  1999-01-13  |  2.0 KB  |  98 lines

  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Dimension;
  4. import java.awt.Graphics;
  5. import java.awt.Image;
  6. import java.awt.Insets;
  7. import java.awt.Panel;
  8. import java.awt.image.ImageObserver;
  9.  
  10. public abstract class BorderPanel2 extends Panel {
  11.    int thickness;
  12.    Image backgroundImage;
  13.    Color backgroundColor;
  14.    Image osImage;
  15.    Graphics osg;
  16.  
  17.    public void SetThickness(int var1) {
  18.       this.thickness = var1;
  19.    }
  20.  
  21.    public void SetThickness(String var1) {
  22.       if (var1 != null) {
  23.          this.thickness = Integer.parseInt(var1);
  24.       } else {
  25.          this.thickness = 4;
  26.       }
  27.    }
  28.  
  29.    public void SetBackgroundColor(Color var1) {
  30.       if (var1 != null) {
  31.          ((Component)this).setBackground(var1);
  32.       }
  33.  
  34.       this.backgroundColor = var1;
  35.    }
  36.  
  37.    public void SetBackgroundImage(Image var1) {
  38.       this.backgroundImage = var1;
  39.    }
  40.  
  41.    public synchronized Dimension minimumSize() {
  42.       return new Dimension(4 * this.thickness, 4 * this.thickness);
  43.    }
  44.  
  45.    public Insets insets() {
  46.       return new Insets(this.thickness, this.thickness, this.thickness, this.thickness);
  47.    }
  48.  
  49.    public void paint(Graphics var1) {
  50.       this.update(var1);
  51.    }
  52.  
  53.    public void update(Graphics var1) {
  54.       if (this.osImage == null) {
  55.          this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  56.          this.osg = this.osImage.getGraphics();
  57.       }
  58.  
  59.       Color var2 = this.osg.getColor();
  60.       this.osg.setColor(((Component)this).getBackground());
  61.       this.osg.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  62.       this.osg.setColor(var2);
  63.       if (this.backgroundImage != null) {
  64.          int var3 = this.backgroundImage.getWidth(this);
  65.          int var4 = this.backgroundImage.getHeight(this);
  66.          int var5 = ((Component)this).size().width / var3;
  67.          int var6 = ((Component)this).size().height / var4;
  68.          ++var5;
  69.          ++var6;
  70.  
  71.          for(int var7 = 0; var7 < var6; ++var7) {
  72.             for(int var8 = 0; var8 < var5; ++var8) {
  73.                this.osg.drawImage(this.backgroundImage, var8 * var3, var7 * var4, this);
  74.             }
  75.          }
  76.       }
  77.  
  78.       this.DoPaint(this.osg);
  79.       var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
  80.    }
  81.  
  82.    public synchronized void reshape(int var1, int var2, int var3, int var4) {
  83.       super.reshape(var1, var2, var3, var4);
  84.       this.osImage = null;
  85.       this.osg = null;
  86.       this.DoResize(var3, var4);
  87.    }
  88.  
  89.    public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
  90.       ((Component)this).repaint();
  91.       return true;
  92.    }
  93.  
  94.    abstract void DoPaint(Graphics var1);
  95.  
  96.    abstract void DoResize(int var1, int var2);
  97. }
  98.