home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.JComponent;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.image.ImageObserver;
-
- class ImageComponent extends JComponent implements ImageObserver {
- protected Image img;
- private boolean imgKnown;
- protected Dimension isize = new Dimension(-1, -1);
- protected Dimension prefsize = new Dimension(0, 0);
- boolean fixedSize = false;
- long lastUpdateTime;
-
- public ImageComponent() {
- }
-
- public ImageComponent(Image var1) {
- this.setImage(var1);
- }
-
- public ImageComponent(String var1) {
- this.setImage(((Component)this).getToolkit().getImage(var1));
- }
-
- public void setSize(int var1, int var2) {
- if (var1 != this.isize.width || var2 != this.isize.height) {
- this.isize.width = var1;
- this.isize.height = var2;
- ((Container)this).invalidate();
- }
-
- }
-
- public void setBounds(int var1, int var2, int var3, int var4) {
- super.setBounds(var1, var2, var3, var4);
- this.setSize(var3, var4);
- }
-
- public void setImage(Image var1) {
- if (this.img != var1) {
- this.img = var1;
- if (var1 != null) {
- this.setSize(var1.getWidth(this), var1.getHeight(this));
- }
-
- if (((Component)this).isShowing()) {
- ((Component)this).repaint(10L);
- }
-
- }
- }
-
- private synchronized void waitSize() {
- if (this.img != null) {
- try {
- while(this.isize.width < 0 || this.isize.height < 0) {
- this.wait();
- }
-
- } catch (InterruptedException var1) {
- }
- }
- }
-
- protected boolean immediatePaint() {
- return true;
- }
-
- public synchronized boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- long var7 = System.currentTimeMillis();
- if ((var2 & 48) != 0) {
- if (this.immediatePaint()) {
- Graphics var9 = ((JComponent)this).getGraphics();
- if (var9 != null) {
- this.paint(var9);
- var9.dispose();
- }
- } else {
- ((Component)this).repaint(0L);
- }
-
- this.lastUpdateTime = var7;
- }
-
- if ((var2 & 192) != 0) {
- Object var10 = null;
- this.isize.width = 0;
- this.isize.height = 0;
- this.notifyAll();
- return false;
- } else {
- if ((var2 & 1) != 0) {
- this.isize.width = var1.getWidth(this);
- }
-
- if ((var2 & 2) != 0) {
- this.isize.height = var1.getHeight(this);
- }
-
- this.notifyAll();
- return (var2 & 32) == 0;
- }
- }
-
- public Dimension getPreferredSize() {
- Insets var1 = ((JComponent)this).getInsets();
- this.waitSize();
- this.prefsize.width = this.isize.width + var1.left + var1.right;
- this.prefsize.height = this.isize.height + var1.top + var1.bottom;
- return this.prefsize;
- }
-
- public Dimension getMinimumSize() {
- return this.getPreferredSize();
- }
-
- protected void locateImage() {
- }
-
- public void paint(Graphics var1) {
- Insets var2 = ((JComponent)this).getInsets();
- Image var3 = this.img;
- if (var3 == null) {
- this.locateImage();
- if ((var3 = this.img) == null) {
- return;
- }
- }
-
- if (var1 == null) {
- System.out.println("NULL GRAPHICS");
- }
-
- if (var2 == null) {
- System.out.println("NULL INSETS");
- }
-
- var1.drawImage(var3, var2.left, var2.top, this);
- }
-
- public void update(Graphics var1) {
- this.paint(var1);
- }
- }
-