home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.image.ImageObserver;
-
- public class PulsingBorderPanel2 extends DynamicBorderPanel2 {
- int red;
- int green;
- int blue;
- int origRed;
- int origGreen;
- int origBlue;
- int redIncrement;
- int greenIncrement;
- int blueIncrement;
- final int increment = 25;
- Image osImage;
- Graphics osg;
- int count;
- Color[] theColors;
- int colorIncrement = 1;
-
- void GetParameters(Applet var1, int var2) {
- String var3 = var1.getParameter("pulsingBorderThickness" + var2);
- ((BorderPanel2)this).SetThickness(AppletParam2.GetInt(var3, 5));
- var3 = var1.getParameter("pulsingBorderBkColor" + var2);
- ((BorderPanel2)this).SetBackgroundColor(AppletParam2.GetColor(var3, (Color)null));
- var3 = var1.getParameter("pulsingBorderBkImage" + var2);
- ((BorderPanel2)this).SetBackgroundImage(AppletParam2.GetImage(var1, var3));
- var3 = var1.getParameter("pulsingBorderColor" + var2);
- this.SetColor(AppletParam2.GetColor(var3, Color.red));
- }
-
- public PulsingBorderPanel2(Applet var1, int var2) {
- this.GetParameters(var1, var2);
- }
-
- public void SetColor(Color var1) {
- this.origRed = var1.getRed();
- this.origGreen = var1.getGreen();
- this.origBlue = var1.getBlue();
- this.red = this.origRed;
- this.green = this.origGreen;
- this.blue = this.origBlue;
- this.redIncrement = (255 - this.red) / 25;
- this.greenIncrement = (255 - this.green) / 25;
-
- for(this.blueIncrement = (255 - this.blue) / 25; this.red <= 255 && this.green <= 255 && this.blue <= 255; ++this.count) {
- this.red += this.redIncrement;
- this.green += this.greenIncrement;
- this.blue += this.blueIncrement;
- }
-
- this.theColors = new Color[this.count];
- this.red = this.origRed;
- this.green = this.origGreen;
- this.blue = this.origBlue;
-
- for(this.count = 0; this.red <= 255 && this.green <= 255 && this.blue <= 255; ++this.count) {
- this.theColors[this.count] = new Color(this.red, this.green, this.blue);
- this.red += this.redIncrement;
- this.green += this.greenIncrement;
- this.blue += this.blueIncrement;
- }
-
- this.red = this.origRed;
- this.green = this.origGreen;
- this.blue = this.origBlue;
- this.count = 0;
- }
-
- void DoPaint(Graphics var1) {
- if (this.osImage == null) {
- this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.osg = this.osImage.getGraphics();
- }
-
- this.osg.setColor(this.theColors[this.count]);
- this.count += this.colorIncrement;
-
- for(int var2 = 0; var2 < super.thickness; ++var2) {
- this.osg.drawRect(var2, var2, ((Component)this).size().width - 2 * var2 - 1, ((Component)this).size().height - 2 * var2 - 1);
- }
-
- this.red += this.redIncrement;
- this.green += this.greenIncrement;
- this.blue += this.blueIncrement;
- if (this.red > 255) {
- this.red = 255;
- }
-
- if (this.green > 255) {
- this.green = 255;
- }
-
- if (this.blue > 255) {
- this.blue = 255;
- }
-
- if (this.count >= this.theColors.length) {
- this.count = this.theColors.length - 1;
- }
-
- if (this.red == 255 && this.green == 255 && this.blue == 255) {
- this.redIncrement = -this.redIncrement;
- this.greenIncrement = -this.greenIncrement;
- this.blueIncrement = -this.blueIncrement;
- this.colorIncrement = -this.colorIncrement;
- }
-
- if (this.red < this.origRed) {
- this.red = this.origRed;
- }
-
- if (this.green < this.origGreen) {
- this.green = this.origGreen;
- }
-
- if (this.blue < this.origBlue) {
- this.blue = this.origBlue;
- }
-
- if (this.count < 0) {
- this.count = 0;
- }
-
- if (this.red == this.origRed && this.green == this.origGreen && this.blue == this.origBlue) {
- this.redIncrement = -this.redIncrement;
- this.greenIncrement = -this.greenIncrement;
- this.blueIncrement = -this.blueIncrement;
- this.colorIncrement = -this.colorIncrement;
- }
-
- var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
- }
-
- void DoResize(int var1, int var2) {
- this.osImage = null;
- this.osg = null;
- }
- }
-