7 Replies Latest reply: Dec 14, 2012 2:53 AM by 795605 RSS

    Help with understanding drawPolygon()

    795605
      I have a triangle that I want to draw using drawPolygon(). This is what I have:
      public void paint(Graphics g)
          {
              int[] xPoints =
              {
                  30, 70, 40
              };
              int[] yPoints =
              {
                  30, 30, 60
              };
              Polygon imageTriangle = new Polygon(xPoints, yPoints, 3);
              g.drawPolygon(imageTriangle);
          }
      So this is what am understanding:

      We have three points, (30, 30), (70, 30) and (40, 60), right?

      From a cartesian plane, this will display an upright pyramid. But the actual program runs producing an upside-down odd shaped triangle.

      Am I missing something? What do I need to do in order to display an upright pyramid?