JDK-4494651 : GraphicsConfiguration objects for BufferedImages report random width and height
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-08-21
  • Updated: 2015-02-10
  • Resolved: 2015-02-10
Related Reports
Duplicate :  
Description
The following test case shows that the GraphicsConfiguration of a BufferedImage
will report the bounds of the first BufferedImage of that type that was
created.

------- BIGCTest.java -------
import java.awt.*;
import java.awt.image.*;

public class BIGCTest {
    public static void main(String argv[]) {
	int type = BufferedImage.TYPE_INT_RGB;
	BufferedImage img1 = new BufferedImage(10, 10, type);
	BufferedImage img2 = new BufferedImage(20, 20, type);
	GraphicsConfiguration gc1 =
	    img1.createGraphics().getDeviceConfiguration();
	GraphicsConfiguration gc2 =
	    img2.createGraphics().getDeviceConfiguration();
	System.out.println("config1 bounds = "+gc1.getBounds());
	System.out.println("config2 bounds = "+gc2.getBounds());
    }
}
-----------------------------

Comments
Normally I would close the new bug as a dup, of the old but I'm making an exception here.
10-02-2015

EVALUATION The bounds for the GraphicsConfig objects really are unrelated to the original image. For a screen component, the bounds would be the dimensions of the screen that it lives on. For an image, it should probably be the maximum dimensions supported by the renderering system that is used to render into those images (MAXINT, MAXINT for the reference runtime probably). The bug here is not that it reports the information from "another image", but that the information reported is not useful.
18-02-2009

WORK AROUND
11-06-2004

SUGGESTED FIX
11-06-2004

PUBLIC COMMENTS
10-06-2004