home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Rectangle;
- import java.awt.image.ImageObserver;
-
- public class JDPProgressBar extends Canvas {
- int width;
- int height;
- int percentComplete;
- Color barColor;
- Image offscreen;
- Rectangle offscreensize;
- // $FF: renamed from: gr java.awt.Graphics
- Graphics field_0;
-
- public Dimension minimimSize() {
- Dimension var1 = new Dimension(9, 9);
- return var1;
- }
-
- public synchronized void paint(Graphics var1) {
- Rectangle var2 = ((Component)this).bounds();
- if (this.offscreen == null || var2.width != this.offscreensize.width || var2.height != this.offscreensize.height) {
- this.offscreen = ((Component)this).createImage(var2.width, var2.height);
- this.offscreensize = var2;
- this.field_0 = this.offscreen.getGraphics();
- this.field_0.setFont(((Component)this).getFont());
- }
-
- Color var3 = ((Component)this).getBackground();
- this.field_0 = this.field_0;
- this.field_0.setColor(var3);
- this.field_0.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
- this.field_0.setColor(((Component)this).getForeground());
- this.field_0.fillRect(1, 2, (((Component)this).bounds().width - 3) * this.percentComplete / 100, ((Component)this).bounds().height - 3);
- this.field_0.setColor(JDPUtils.darker(var3));
- this.field_0.drawLine(0, 0, ((Component)this).bounds().width - 1, 0);
- this.field_0.drawLine(0, 0, 0, ((Component)this).bounds().height - 1);
- this.field_0.setColor(JDPUtils.darker(JDPUtils.darker(var3)));
- this.field_0.drawLine(1, 1, ((Component)this).bounds().width - 2, 1);
- this.field_0.drawLine(1, 1, 1, ((Component)this).bounds().height - 2);
- this.field_0.setColor(JDPUtils.brighter(var3));
- this.field_0.drawLine(((Component)this).bounds().width - 1, 1, ((Component)this).bounds().width - 1, ((Component)this).bounds().height - 1);
- this.field_0.drawLine(0, ((Component)this).bounds().height - 1, ((Component)this).bounds().width - 1, ((Component)this).bounds().height - 1);
- var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
- }
-
- public JDPProgressBar() {
- this.barColor = Color.blue;
- ((Component)this).setForeground(this.barColor);
- this.percentComplete = 0;
- }
-
- public JDPProgressBar(int var1, int var2, Color var3) {
- this.width = var1;
- this.height = var2;
- this.barColor = var3;
- this.percentComplete = 0;
- ((Component)this).reshape(0, 0, var1, var2);
- }
-
- public JDPProgressBar(Color var1) {
- this.barColor = var1;
- ((Component)this).setForeground(var1);
- this.percentComplete = 0;
- }
-
- public synchronized void setPercent(int var1) {
- if (var1 < 0) {
- var1 = 0;
- }
-
- if (var1 > 100) {
- var1 = 100;
- }
-
- this.percentComplete = var1;
- ((Component)this).repaint();
- }
-
- public int getPercent() {
- return this.percentComplete;
- }
-
- public synchronized void update(Graphics var1) {
- this.paint(var1);
- }
-
- public Dimension preferredSize() {
- Dimension var1 = this.minimimSize();
- return var1;
- }
- }
-