src/share/classes/java/awt/image/MemoryImageSource.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -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);