home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / plaf / basic / HueLightnessPatch$1.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.7 KB  |  69 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.SyntheticImage;
  4. import java.awt.Adjustable;
  5. import java.awt.Color;
  6. import java.awt.Dimension;
  7.  
  8. final class HueLightnessPatch$1 extends SyntheticImage {
  9.    int color;
  10.    int nextColor;
  11.    Adjustable hue;
  12.    boolean changed;
  13.  
  14.    public synchronized void nextFrame(int var1) {
  15.       var1 |= -16777216;
  16.       if (this.color != var1) {
  17.          this.changed = true;
  18.          this.notifyAll();
  19.       }
  20.  
  21.       this.nextColor = var1;
  22.    }
  23.  
  24.    private synchronized void waitNextColor() {
  25.       try {
  26.          while(!this.changed) {
  27.             this.wait();
  28.          }
  29.       } catch (InterruptedException var1) {
  30.       }
  31.  
  32.       this.changed = false;
  33.       this.color = this.nextColor;
  34.    }
  35.  
  36.    protected boolean isStatic() {
  37.       return false;
  38.    }
  39.  
  40.    protected void computeRow(int var1, int[] var2) {
  41.       if (var1 == 0) {
  42.          this.waitNextColor();
  43.       }
  44.  
  45.       float var3 = (float)this.hue.getValue() / 360.0F;
  46.       float var4 = (float)(super.height - var1 - 1) / (float)(super.height - 1);
  47.       int var5 = super.width;
  48.       int var6 = var5;
  49.  
  50.       while(true) {
  51.          --var6;
  52.          if (var6 < 0) {
  53.             return;
  54.          }
  55.  
  56.          float var7 = (float)(var5 - var6 - 1) / (float)(var5 - 1);
  57.          var2[var6] = Color.HSBtoRGB(var3, var7, var4);
  58.       }
  59.    }
  60.  
  61.    // $FF: synthetic method
  62.    HueLightnessPatch$1(int var1, Adjustable var2, Dimension var3) {
  63.       this.hue = var2;
  64.       super.width = var3.width;
  65.       super.height = var3.height;
  66.       this.nextFrame(var1);
  67.    }
  68. }
  69.