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

Graphics.drawPolygon does not close the polygon

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.6
    • Not verified

      The documentaton indicates that drawPolygon will close the polygon. JDK 1.02. does not for Solaris or Win32.

      The code below exeplifies the problem.
      // class to provide a frame for testing Image Keys
      class PolygonTest extends Frame implements Runnable
      {
              static int X = 50;
              static int Y = 50;
              int inner_xpoints[] = { 0, 0, X, X };
              int inner_ypoints[] = { 0, Y, Y, 0 };

              public PolygonTest()
              {
                      resize(200,200);
                      show();
              }

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

              public void run()
              {
              }

              public void paint(Graphics g) {
                      g.translate(50,50);
                      g.drawPolygon(inner_xpoints, inner_ypoints, 4);
              }
      }

      public abstract void
      drawPolygon(int xPoints[], int yPoints[], int nPoints)

           Draws a closed polygon defined by an array of x points and y points.

           This method draws the polygon defined by npoint line segments, where
           the first npoint-1 line segments are lines segments from [Image] to
           [Image], for [Image]. The last line segment starts at the final point
           and ends at the first point.

            flar Jim Graham
            bcaperonsunw Bren Caperon (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: