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

Method Polygon.getBounds() returns incorrect value.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: aaC67449 Date: 02/10/98


      Method Polygon.getBounds() returns incorrect value whenever another
      point is added to the polygon.

      The problem is originated from void Polygon.updateBounds().

      -------------------Example-----------------------------------
      import java.awt.*;

      public class Test {

         public static void main(String argv[]) {
              int x[]={2,2,2};
              int y[]={2,3,4};
              Polygon p=new Polygon(x,y,3);
              p.getBounds();
              p.addPoint(1,1);
              if(!p.getBounds().equals(new Rectangle(1,1,1,3)))
                    System.out.println("Failed. Incorrect bounds returned: "
                    +p.getBounds());
         }

      }


      -------------------Output------------------------------------
      Failed. Incorrect bounds returned: java.awt.Rectangle[x=1,y=1,width=0,height=2]


      Please note that this bug is already fixed in JDK 1.2. It exists
      only in versions 1.1.6 or earlier.


      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmendenhsunw David Mendenhall (Inactive)
              Reporter:
              aalievsunw Artem Aliev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: