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

geom.Arc2DFloat getBounds2D() method doc problems

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.2
    • 1.2.2
    • docs
    • 1.2.2
    • generic
    • generic

      The specs say that getBounds() returns a Rectangle object which represents the
      bounding box of the Shape. getBounds2D() on the other hand returns a
      Rectangle2D object which represents the high-precision bounding box of the Arc.

      However, for the same Arc, the values returned by the two methods are very
      different.
      import java.awt.geom.Arc2D;
      import java.awt.geom.Rectangle2D;
      import java.awt.Rectangle;

      public class Test {
      public Test() {

      String msg = "Arc2D.Float.getBounds2D(): ";

      try {
      Arc2D.Float arc = new Arc2D.Float(10,15,25,40,44,100,Arc2D.OPEN);

      System.out.println(arc+".getBounds() returns "+arc.getBounds());
      System.out.println();
      System.out.println(arc+".getBounds2D() returns "+arc.getBounds2D());

      } catch (Throwable ee) {
      System.out.println(msg+": got Exception "+ee);
      }
      }

      public static void main(String args[]) {
      new Test();
      }
        }


      Although the Shape interface documents that the Bounds2D is likely
      to be tighter, the doc needs to be specific about the difference
      between the values returned by getBounds() and getBounds2D().

            jballsunw Jennifer Ball (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: