Package java.awt

Examples of java.awt.Polygon


      g.setColor(oldColor);
    }

    private Polygon getArrow() {
      if (mArrow == null) {
        mArrow = new Polygon();
        if (mDirection == ScrollDirection.UP) {
          mArrow.addPoint((int) (getSize().width / 2.0 - 6.0 + 0.5), (int) (getSize().height / 2.0 + 3.0 + 0.5));
          mArrow.addPoint((int) (getSize().width / 2.0 + 6.0 + 0.5), (int) (getSize().height / 2.0 + 3.0 + 0.5));
          mArrow.addPoint((int) (getSize().width / 2.0 + 0.5), (int) (getSize().height / 2.0 - 4.0 + 0.5));
        } else {
View Full Code Here


  /**
   * @see Graphics#drawPolygon(int[], int[], int)
   */
  public void drawPolygon(final int[] xPoints, final int[] yPoints, final int nPoints)
  {
    final Polygon poly = new Polygon();
    for (int i = 0; i < nPoints; i++)
    {
      poly.addPoint(xPoints[i], yPoints[i]);
    }
    draw(poly);
  }
View Full Code Here

  /**
   * @see Graphics#fillPolygon(int[], int[], int)
   */
  public void fillPolygon(final int[] xPoints, final int[] yPoints, final int nPoints)
  {
    final Polygon poly = new Polygon();
    for (int i = 0; i < nPoints; i++)
    {
      poly.addPoint(xPoints[i], yPoints[i]);
    }
    fill(poly);
  }
View Full Code Here

   * @see Graphics#drawPolyline
   */
  public void drawPolygon(final int[] xPoints, final int[] yPoints,
                          final int nPoints)
  {
    parent.draw(new Polygon(xPoints, yPoints, nPoints));
  }
View Full Code Here

   * @see Graphics#drawPolygon(int[], int[], int)
   */
  public void fillPolygon(final int[] xPoints, final int[] yPoints,
                          final int nPoints)
  {
    parent.fill(new Polygon(xPoints, yPoints, nPoints));
  }
View Full Code Here

                this(n, d, xp, yp, (AffineTransform) null);
            }

            public Poly(String n, String d, int[] xp, int[] yp,
                    AffineTransform af) {
                super(n, d, new Polygon(xp, yp, xp.length), af);
            }
View Full Code Here

            /*
             * very crude technique just break each segment up into
             * steps lines
             */
            Polygon p = new Polygon();
            p.addPoint((int) Math.round(X[0].eval(0)),
                    (int) Math.round(Y[0].eval(0)));
            for (int i = 0; i < X.length; i++) {
                for (int j = 1; j <= steps; j++) {
                    float u = j / (float) steps;
                    p.addPoint(Math.round(X[i].eval(u)),
                            Math.round(Y[i].eval(u)));
                }
            }

            // copy polygon points to the return array
View Full Code Here

            /*
             * very crude technique just break each segment up into
             * steps lines
             */
            Polygon p = new Polygon();
            p.addPoint((int) Math.round(X[0].eval(0)),
                    (int) Math.round(Y[0].eval(0)));
            for (int i = 0; i < X.length; i++) {
                for (int j = 1; j <= steps; j++) {
                    float u = j / (float) steps;
                    p.addPoint(Math.round(X[i].eval(u)),
                            Math.round(Y[i].eval(u)));
                }
            }

            res = new float[p.npoints * 2];
 
View Full Code Here

                height = fm.getAscent();
                descent = 0;
            }

            int nLines = parsedData.length;
            polyBounds = new Polygon();

            computeStringWidths(fm);

            int baselineOffset = 0; // baseline == BASELINE_BOTTOM,
            // normal.
View Full Code Here

        g.setStroke(stroke);
        g.drawLine(0, middleY, width, middleY);

        int upTip = (int) ((float) height * .25);
        int downTip = (int) ((float) height * .75);
        Polygon poly = null;
        if (arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_FORWARD
                || arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BOTH) {
            int rightWingX = (int) ((float) width * .75);
            poly = new Polygon(new int[] { width, rightWingX, rightWingX }, new int[] {
                    middleY, upTip, downTip }, 3);
            g.fill(poly);
            g.draw(poly); // Seems to help with rendering problem.
        }

        if (arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BACKWARD
                || arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BOTH) {
            int leftWingX = (int) ((float) width * .25);
            poly = new Polygon(new int[] { 0, leftWingX, leftWingX }, new int[] {
                    middleY, upTip, downTip }, 3);
            g.fill(poly);
            g.draw(poly); // Seems to help with rendering problem.
        }

View Full Code Here

TOP

Related Classes of java.awt.Polygon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.