Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4494651

GraphicsConfiguration objects for BufferedImages report random width and height

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs
    • None
    • 2d
    • generic
    • generic

      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());
          }
      }
      -----------------------------

            prr Philip Race
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: