home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.image.ImageObserver;
-
- public class JDPImage extends Panel {
- static boolean activated;
- JDPUser user;
- Image thisImage;
- String imageLoc;
- String prevImageLoc;
- JDPImageLoader imageLoader;
- int iwidth;
- int iheight;
- Image offscreen;
- Rectangle offscreensize;
- // $FF: renamed from: gr java.awt.Graphics
- Graphics field_0;
- Dimension Bounds;
-
- public String getImagePath() {
- return this.imageLoc;
- }
-
- public void setImagePath(String var1) {
- if (var1 != null) {
- if (this.imageLoc == null || !var1.equals(this.imageLoc)) {
- this.imageLoc = var1;
- this.thisImage = null;
- ((Component)this).repaint();
- }
- }
- }
-
- public void paint(Graphics var1) {
- this.update(var1);
- }
-
- public Dimension minimumSize() {
- Dimension var1 = new Dimension(this.iwidth, this.iheight);
- if (this.iwidth == 0 && this.iheight == 0) {
- var1.width = 200;
- var1.height = 30;
- }
-
- return var1;
- }
-
- public JDPImage(JDPUser var1) {
- activated = JDPUser.classactivated;
- if (!activated) {
- System.out.println("Software Violation - this class may only be used in conjunction with JDesignerPro.");
- } else {
- this.user = var1;
- }
- }
-
- public JDPImage(JDPUser var1, String var2) {
- activated = JDPUser.classactivated;
- if (!activated) {
- System.out.println("Software Violation - this class may only be used in conjunction with JDesignerPro.");
- } else {
- this.user = var1;
- this.imageLoc = var2;
- }
- }
-
- public void update(Graphics var1) {
- this.Bounds = ((Component)this).size();
- Rectangle var2 = ((Component)this).bounds();
- if (this.offscreen == null || var2.width != this.offscreensize.width || var2.height != this.offscreensize.height) {
- try {
- this.offscreen = ((Component)this).createImage(var2.width, var2.height);
- } catch (Exception var6) {
- if (this.user.mainmsg != null) {
- this.user.mainmsg.setStatusMsg("Out of Memory. Please increase usable memory", 20);
- }
-
- return;
- }
-
- this.offscreensize = var2;
- this.field_0 = this.offscreen.getGraphics();
- }
-
- if (this.imageLoader != null && this.imageLoader.getImageReady()) {
- this.thisImage = this.imageLoader.thisImage;
- this.imageLoader = null;
- }
-
- this.field_0.setColor(((Component)this).getBackground());
- this.field_0.fillRect(0, 0, this.Bounds.width, this.Bounds.height);
- if (this.imageLoc != null && !this.imageLoc.equals("")) {
- String var3 = this.imageLoc;
-
- try {
- if (this.thisImage != null && this.thisImage.getWidth((ImageObserver)null) > 0) {
- if (this.iwidth == 0) {
- this.iwidth = this.thisImage.getWidth((ImageObserver)null);
- this.iheight = this.thisImage.getHeight((ImageObserver)null);
- ((Component)this).resize(this.iwidth, this.iheight);
- }
-
- if (this.iwidth != 0 && this.iheight != 0) {
- this.field_0.drawImage(this.thisImage, 0, 0, this.iwidth, this.iheight, (ImageObserver)null);
- } else {
- this.field_0.drawImage(this.thisImage, 0, 0, (ImageObserver)null);
- }
- } else if (!var3.equals(this.prevImageLoc)) {
- this.iwidth = 0;
- this.iheight = 0;
- this.imageLoader = new JDPImageLoader(this.user, this, var3);
- (new Thread(this.imageLoader)).start();
- this.prevImageLoc = var3;
- } else {
- this.field_0.setColor(Color.black);
- this.field_0.drawRect(0, 0, this.Bounds.width - 1, this.Bounds.height - 1);
- this.field_0.drawString("Image " + var3 + " not found", 3, 12);
- }
- } catch (Exception var7) {
- ((Throwable)var7).printStackTrace();
- }
- } else {
- this.field_0.setColor(Color.black);
- this.field_0.drawRect(0, 0, this.Bounds.width - 1, this.Bounds.height - 1);
- this.field_0.drawString("Image not defined", 3, 12);
- }
-
- var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
- }
-
- public void setDimension(int var1, int var2) {
- Dimension var3 = new Dimension(var1, var2);
- this.setDimension(var3);
- }
-
- public void setHeight(int var1) {
- this.setDimension(this.getWidth(), var1);
- }
-
- public int getHeight() {
- return ((Component)this).bounds().height;
- }
-
- public void setDimension(Dimension var1) {
- Dimension var2 = this.minimumSize();
- if (var1.width != var2.width || var1.height != var2.height) {
- this.iwidth = var1.width;
- this.iheight = var1.height;
- ((Component)this).resize(this.iwidth, this.iheight);
- ((Component)this).repaint();
- }
- }
-
- public Dimension getDimension() {
- Dimension var1 = new Dimension(this.iwidth, this.iheight);
- return var1;
- }
-
- public Dimension preferredSize() {
- return this.minimumSize();
- }
-
- public void layout() {
- ((Component)this).repaint();
- }
-
- public void setWidth(int var1) {
- this.setDimension(var1, this.getHeight());
- }
-
- public int getWidth() {
- return ((Component)this).bounds().width;
- }
- }
-