home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Panel;
-
- class OCsliderRGB extends Panel {
- public int RGBcomp = 0;
- public Color bgColor;
- private boolean paint_called;
- private boolean first_run;
- private Image off;
- private Graphics g_off;
- private Image sloff;
- private Graphics g_sloff;
- private Image aroff;
- private Graphics g_aroff;
- private Image erase;
- // $FF: renamed from: ds java.awt.Dimension
- private Dimension field_0;
- public int sVal;
- private int arrow_step;
- private int arrow_pos;
- private int last_arrow_pos;
- private int arrow_width;
- private int arrow_height;
- private int slide_height;
- private int slide_width;
- private int slide_x;
- private int slide_y;
-
- private void initArrow() {
- this.aroff = ((Component)this).createImage(this.arrow_width, this.arrow_height);
- this.g_aroff = this.aroff.getGraphics();
- this.g_aroff.setColor(this.bgColor);
- this.g_aroff.fillRect(0, 0, this.arrow_width, this.arrow_height);
- this.g_aroff.setColor(Color.black);
- int var1 = 0;
- int var2 = 0;
- int var3 = 8;
-
- do {
- this.g_aroff.drawLine(var1, var2, var1 + var3, var2);
- ++var2;
- ++var1;
- var3 -= 2;
- } while(var3 >= 0);
-
- }
-
- private void figureSizing() {
- this.slide_width = this.field_0.width - this.arrow_width - 2;
- this.slide_x = this.arrow_width / 2;
- this.slide_y = this.field_0.height - (this.arrow_height + 1);
- }
-
- OCsliderRGB(int var1) {
- this.bgColor = ACutilb.windowColor;
- this.first_run = false;
- this.sVal = 0;
- this.arrow_step = 0;
- this.arrow_pos = 0;
- this.last_arrow_pos = 0;
- this.arrow_width = 9;
- this.arrow_height = 7;
- this.slide_height = 6;
- this.RGBcomp = var1;
- }
-
- public void paint(Graphics var1) {
- this.paint_called = true;
- this.paintIt();
- }
-
- private synchronized void paintIt() {
- if (this.paint_called) {
- if (!this.first_run) {
- ((Component)this).setBackground(this.bgColor);
- if (this.field_0.height >= 1 && this.field_0.width >= 1) {
- this.off = ((Component)this).createImage(this.field_0.width, this.field_0.height);
- this.g_off = this.off.getGraphics();
- this.erase = ((Component)this).createImage(this.arrow_width, this.arrow_height);
- Graphics var1 = this.erase.getGraphics();
- var1.setColor(this.bgColor);
- var1.fillRect(0, 0, this.arrow_width, this.arrow_height);
- this.initSlider();
- this.initArrow();
- this.drawArrow();
- this.g_off.drawImage(this.sloff, this.slide_x, this.slide_y, this);
- this.first_run = true;
- this.paintIt();
- }
- } else {
- ((Component)this).getGraphics().drawImage(this.off, 0, 0, this);
- }
- }
- }
-
- public void resize(Dimension var1) {
- if (var1.width * var1.height > 0) {
- this.field_0 = var1;
- this.figureSizing();
- super.resize(var1);
- }
- }
-
- public void resize(int var1, int var2) {
- if (var1 * var2 > 0) {
- this.field_0 = new Dimension(var1, var2);
- this.figureSizing();
- super.resize(var1, var2);
- }
- }
-
- private void drawArrow() {
- this.g_off.drawImage(this.erase, this.last_arrow_pos, this.field_0.height - this.slide_height - this.arrow_height - 2, this);
- this.g_off.drawImage(this.aroff, this.arrow_pos, this.field_0.height - this.slide_height - this.arrow_height - 2, this);
- }
-
- private void initSlider() {
- this.sloff = ((Component)this).createImage(this.slide_width, this.slide_height);
- this.g_sloff = this.sloff.getGraphics();
- int var1 = 0;
- int var2 = 0;
- int var3 = 0;
- float var4 = 0.0F;
- float var5 = 0.0F;
- float var6 = 0.0F;
- if (this.RGBcomp == 0) {
- var4 = 255.0F / (float)this.slide_width;
- } else if (this.RGBcomp == 1) {
- var5 = 255.0F / (float)this.slide_width;
- } else if (this.RGBcomp == 2) {
- var6 = 255.0F / (float)this.slide_width;
- }
-
- for(int var7 = 0; var7 < this.slide_width; var7 += 4) {
- this.g_sloff.setColor(new Color(var1, var2, var3));
- this.g_sloff.fillRect(var7, 0, var7 + 4, this.slide_height);
- if (this.RGBcomp == 0) {
- var1 = (int)(var4 * (float)var7);
- } else if (this.RGBcomp == 1) {
- var2 = (int)(var5 * (float)var7);
- } else if (this.RGBcomp == 2) {
- var3 = (int)(var6 * (float)var7);
- }
- }
-
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- if (var2 > this.slide_x && var2 < this.slide_x + this.slide_width) {
- this.arrow_pos = var2 - this.slide_x;
- this.drawArrow();
- this.paintIt();
- ((Component)this).requestFocus();
- this.last_arrow_pos = this.arrow_pos;
- this.postChangeVal();
- return true;
- } else {
- return true;
- }
- }
-
- public int getVal() {
- return (int)((float)this.arrow_pos / (float)this.slide_width * 255.0F);
- }
-
- private void postChangeVal() {
- super.postEvent(new Event(this, 901, (new Integer(this.getVal())).toString()));
- }
-
- public void setPos(int var1) {
- this.sVal = var1;
- this.arrow_pos = (int)((float)var1 / 255.0F * (float)this.slide_width);
- if (this.first_run) {
- this.drawArrow();
- }
-
- this.last_arrow_pos = this.arrow_pos;
- if (this.first_run) {
- this.paintIt();
- }
-
- }
-
- public void reshape(int var1, int var2, int var3, int var4) {
- if (var3 * var4 > 0) {
- this.field_0 = new Dimension(var3, var4);
- this.figureSizing();
- super.reshape(var1, var2, var3, var4);
- }
- }
- }
-