Package java.awt

Examples of java.awt.Polygon


    yPoints[Math.max(selected[0], selected[1])] = (this.shape.ypoints[selected[0]] + this.shape.ypoints[selected[1]]) / 2;
    for (int i = Math.max(selected[0], selected[1]); i < this.shape.npoints; i++) {
        xPoints[i + 1] = this.shape.xpoints[i];
        yPoints[i + 1] = this.shape.ypoints[i];
    }
    this.shape = new Polygon(xPoints, yPoints, ++numPoints);
    this.pointSelected = new boolean[numPoints];
    for (int i = 0; i < numPoints; i++) {
        this.pointSelected[i] = false;
    }
    this.pointSelected[Math.max(selected[0], selected[1])] = true;
View Full Code Here


    int iOffset = (int) offset;

    Shape square = new Rectangle2D.Double(-offset, -offset, size, size);
    Shape circle = new Ellipse2D.Double(-offset, -offset, size, size);
    Shape triangle = new Polygon(new int[] {0, iOffset, -iOffset}, new int[] {
        -iOffset, iOffset, iOffset}, 3);
    Shape diamond = new Polygon(new int[] {0, iOffset, 0, -iOffset}, new int[] {
        -iOffset, 0, iOffset, 0}, 4);
    Shape ellipse = new Ellipse2D.Double(-offset, -offset / 2, size, size / 2);

    return new DefaultDrawingSupplier(colors,
        DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
View Full Code Here

        }

        @Override
        protected void paintComponent(Graphics g) {
            g.setColor(Color.green);
            Polygon poly = new Polygon();
            JComponent thumb = this;
            poly.addPoint(thumb.getWidth()/2,0);
            poly.addPoint(0,thumb.getHeight()/2);
            poly.addPoint(thumb.getWidth()/2,thumb.getHeight());
            poly.addPoint(thumb.getWidth(),thumb.getHeight()/2);
            g.fillPolygon(poly);
        }
View Full Code Here

        result[1] = new Ellipse2D.Double(-delta, -delta, size, size);

        // up-pointing triangle
        xpoints = intArray(0.0, delta, -delta);
        ypoints = intArray(-delta, delta, delta);
        result[2] = new Polygon(xpoints, ypoints, 3);

        // diamond
        xpoints = intArray(0.0, delta, 0.0, -delta);
        ypoints = intArray(-delta, 0.0, delta, 0.0);
        result[3] = new Polygon(xpoints, ypoints, 4);

        // horizontal rectangle
        result[4] = new Rectangle2D.Double(-delta, -delta / 2, size, size / 2);

        // down-pointing triangle
        xpoints = intArray(-delta, +delta, 0.0);
        ypoints = intArray(-delta, -delta, delta);
        result[5] = new Polygon(xpoints, ypoints, 3);

        // horizontal ellipse
        result[6] = new Ellipse2D.Double(-delta, -delta / 2, size, size / 2);

        // right-pointing triangle
        xpoints = intArray(-delta, delta, -delta);
        ypoints = intArray(-delta, 0.0, delta);
        result[7] = new Polygon(xpoints, ypoints, 3);

        // vertical rectangle
        result[8] = new Rectangle2D.Double(-delta / 2, -delta, size / 2, size);

        // left-pointing triangle
        xpoints = intArray(-delta, delta, delta);
        ypoints = intArray(0.0, -delta, +delta);
        result[9] = new Polygon(xpoints, ypoints, 3);

        return result;

    }
View Full Code Here

                    double valueP1 = meterMiddleX
                            + (radius * Math.cos(Math.PI * (valueAngle / 180)));
                    double valueP2 = meterMiddleY
                            - (radius * Math.sin(Math.PI * (valueAngle / 180)));

                    Polygon arrow = new Polygon();
                    if ((valueAngle > 135 && valueAngle < 225)
                        || (valueAngle < 45 && valueAngle > -45)) {

                        double valueP3 = (meterMiddleY
                                - DEFAULT_CIRCLE_SIZE / 4);
                        double valueP4 = (meterMiddleY
                                + DEFAULT_CIRCLE_SIZE / 4);
                        arrow.addPoint((int) meterMiddleX, (int) valueP3);
                        arrow.addPoint((int) meterMiddleX, (int) valueP4);

                    }
                    else {
                        arrow.addPoint((int) (meterMiddleX
                                - DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY);
                        arrow.addPoint((int) (meterMiddleX
                                + DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY);
                    }
                    arrow.addPoint((int) valueP1, (int) valueP2);
                    g2.fill(arrow);

                    Ellipse2D circle = new Ellipse2D.Double(meterMiddleX
                            - DEFAULT_CIRCLE_SIZE / 2, meterMiddleY
                            - DEFAULT_CIRCLE_SIZE / 2, DEFAULT_CIRCLE_SIZE,
View Full Code Here

      this.fixedAutoRange = 0.0;

      this.autoTickUnitSelection = DEFAULT_AUTO_TICK_UNIT_SELECTION;
      this.standardTickUnits = standardTickUnits;

      Polygon p1 = new Polygon();
      p1.addPoint(0, 0);
      p1.addPoint(-2, 2);
      p1.addPoint(2, 2);

      this.upArrow = p1;

      Polygon p2 = new Polygon();
      p2.addPoint(0, 0);
      p2.addPoint(-2, -2);
      p2.addPoint(2, -2);

      this.downArrow = p2;

      Polygon p3 = new Polygon();
      p3.addPoint(0, 0);
      p3.addPoint(-2, -2);
      p3.addPoint(-2, 2);

      this.rightArrow = p3;

      Polygon p4 = new Polygon();
      p4.addPoint(0, 0);
      p4.addPoint(2, -2);
      p4.addPoint(2, 2);

      this.leftArrow = p4;

      this.verticalTickLabels = false;
      this.minorTickCount = 0;
View Full Code Here

    polygons = new ArrayList<MyPolygonFilter>();
  }

  public void showAll() {
    ArrayList<MyPolygonFilter> pol = new ArrayList<MyPolygonFilter>();
    pol.add(new MyPolygonFilter(new Polygon(new int[] { 0, getWidth(),
        getWidth(), 0 }, new int[] { 0, 0, getHeight(), getHeight() },
        4), false));
    setPolygons(pol);
  }
View Full Code Here

    this.hide = isHide;
  }

  public MyPolygonFilter() {
    super();
    this.polygon = new Polygon();
    this.hide = false;
  }
View Full Code Here

        if (pass == 0) {
            //  On first pass render the areas, line and outlines

            if (item == 0) {
                // Create a new Area for the series
                areaState.setSeriesArea(new Polygon());
                areaState.setLastSeriesPoints(
                        areaState.getCurrentSeriesPoints());
                areaState.setCurrentSeriesPoints(new Stack());

                // start from previous height (ph1)
View Full Code Here

        transY1 = restrictValueToDataArea(transY1, plot, dataArea);

        if (this.pArea == null && !Double.isNaN(y1)) {

            // Create a new Area for the series
            this.pArea = new Polygon();

            // start from Y = rangeBase
            double transY2 = rangeAxis.valueToJava2D(getRangeBase(), dataArea,
                    plot.getRangeAxisEdge());
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.