src/share/classes/java/awt/image/MemoryImageSource.java

Print this page

        

@@ -109,12 +109,12 @@
     int height;
     ColorModel model;
     Object pixels;
     int pixeloffset;
     int pixelscan;
-    Hashtable properties;
-    Vector theConsumers = new Vector();
+    Hashtable<?, ?> properties;
+    Vector<ImageConsumer> theConsumers = new Vector<>();
     boolean animating;
     boolean fullbuffers;
 
     /**
      * Constructs an ImageProducer object which uses an array of bytes

@@ -195,19 +195,19 @@
     {
         initialize(w, h, cm, (Object) pix, off, scan, props);
     }
 
     private void initialize(int w, int h, ColorModel cm,
-                            Object pix, int off, int scan, Hashtable props) {
+                            Object pix, int off, int scan, Hashtable<?, ?> props) {
         width = w;
         height = h;
         model = cm;
         pixels = pix;
         pixeloffset = off;
         pixelscan = scan;
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<>();
         }
         properties = props;
     }
 
     /**

@@ -341,13 +341,13 @@
      *       multi-frame animation
      */
     public synchronized void setAnimated(boolean animated) {
         this.animating = animated;
         if (!animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
                 if (isConsumer(ic)) {
                     ic.imageComplete(ImageConsumer.IMAGEERROR);
                 }
             }

@@ -374,13 +374,13 @@
         if (this.fullbuffers == fullbuffers) {
             return;
         }
         this.fullbuffers = fullbuffers;
         if (animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.setHints(fullbuffers
                             ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                                ImageConsumer.COMPLETESCANLINES)
                             : ImageConsumer.RANDOMPIXELORDER);
             }

@@ -472,13 +472,13 @@
                 }
             }
             if ((w <= 0 || h <= 0) && !framenotify) {
                 return;
             }
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 if (w > 0 && h > 0) {
                     sendPixels(ic, x, y, w, h);
                 }
                 if (framenotify && isConsumer(ic)) {
                     ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);