home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.image;
-
- import java.awt.Image;
- import java.awt.image.ImageObserver;
- import java.util.Enumeration;
- import java.util.NoSuchElementException;
- import java.util.Vector;
-
- public class ImageWatched {
- protected Vector watchers;
-
- public synchronized void addWatcher(ImageObserver var1) {
- if (var1 != null && !this.isWatcher(var1)) {
- if (this.watchers == null) {
- this.watchers = new Vector();
- }
-
- this.watchers.addElement(var1);
- }
-
- }
-
- public synchronized boolean isWatcher(ImageObserver var1) {
- return this.watchers != null && var1 != null && this.watchers.contains(var1);
- }
-
- public synchronized void removeWatcher(ImageObserver var1) {
- if (var1 != null && this.watchers != null) {
- this.watchers.removeElement(var1);
- if (this.watchers.size() == 0) {
- this.watchers = null;
- }
- }
-
- }
-
- public void newInfo(Image var1, int var2, int var3, int var4, int var5, int var6) {
- if (this.watchers != null) {
- Enumeration var7 = this.watchers.elements();
- Vector var8 = null;
-
- while(var7.hasMoreElements()) {
- ImageObserver var9;
- try {
- var9 = (ImageObserver)var7.nextElement();
- } catch (NoSuchElementException var10) {
- break;
- }
-
- if (!var9.imageUpdate(var1, var2, var3, var4, var5, var6)) {
- if (var8 == null) {
- var8 = new Vector();
- }
-
- var8.addElement(var9);
- }
- }
-
- if (var8 != null) {
- var7 = var8.elements();
-
- while(var7.hasMoreElements()) {
- ImageObserver var12 = (ImageObserver)var7.nextElement();
- this.removeWatcher(var12);
- }
- }
- }
-
- }
- }
-