-
Bug
-
Resolution: Fixed
-
P3
-
5.0u1
There is next phrase in spec for
method flush of class java.awt.image.VolatileImage.
This method will cause the contents of the image to be lost, so calls to contentsLost() will return true and the image must be validated before it can be used again.
But it is wrong. See next example.
-------------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.image.*;
class Flush {
final static int width = 40;
final static int height = 20;
static GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
static GraphicsDevice gd = ge.getDefaultScreenDevice();
static GraphicsConfiguration gc = gd.getDefaultConfiguration();
public static VolatileImage createVolatileImage(){
VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
return vi;
}
public static void main(String[] a) {
VolatileImage vi = createVolatileImage();
vi.flush();
if (!vi.contentsLost()) {
System.out.println("contentsLost returned false after flush.");
}
}
}
###@###.### 10/11/04 11:11 GMT
method flush of class java.awt.image.VolatileImage.
This method will cause the contents of the image to be lost, so calls to contentsLost() will return true and the image must be validated before it can be used again.
But it is wrong. See next example.
-------------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.image.*;
class Flush {
final static int width = 40;
final static int height = 20;
static GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
static GraphicsDevice gd = ge.getDefaultScreenDevice();
static GraphicsConfiguration gc = gd.getDefaultConfiguration();
public static VolatileImage createVolatileImage(){
VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
return vi;
}
public static void main(String[] a) {
VolatileImage vi = createVolatileImage();
vi.flush();
if (!vi.contentsLost()) {
System.out.println("contentsLost returned false after flush.");
}
}
}
###@###.### 10/11/04 11:11 GMT