Package java.awt

Examples of java.awt.BasicStroke$DashIterator$Line


    if (layoutContext != null)
    {
      final Object o = layoutContext.getStyleProperty(ElementStyleKeys.STROKE);
      if (o instanceof BasicStroke)
      {
        final BasicStroke stroke = (BasicStroke) o;
        extraPadding = stroke.getLineWidth() / 2.0;
      }
      else
      {
        extraPadding = 0.5;
      }
View Full Code Here


    factory.setFormatString("d-MMM-yyyy");
    factory.setFieldname("report.date");
    header.addElement(factory.createElement());

    final Element line = HorizontalLineElementFactory.createHorizontalLine(16);
    line.getStyle().setStyleProperty(ElementStyleKeys.STROKE, new BasicStroke(2));
    line.getStyle().setStyleProperty(ElementStyleKeys.PAINT, Color.decode("#CFCFCF"));
    header.addElement(line);
    return header;
  }
View Full Code Here

    items.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(10));
    items.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.decode("#dfdfdf"));


    items.addElement(HorizontalLineElementFactory.createHorizontalLine
        (0, Color.decode("#DFDFDF"), new BasicStroke(0.1f)));
    items.addElement(HorizontalLineElementFactory.createHorizontalLine
        (10, Color.decode("#DFDFDF"), new BasicStroke(0.1f)));

    TextFieldElementFactory factory = new TextFieldElementFactory();
    factory.setName("Country Element");
    factory.setAbsolutePosition(new Point2D.Float(0, 0));
    factory.setMinimumSize(new FloatDimension(176, 10));
View Full Code Here

    tfactory.setVerticalAlignment(ElementAlignment.MIDDLE);
    tfactory.setNullString("<null>");
    tfactory.setFieldname("Continent");
    header.addElement(tfactory.createElement());

    header.addElement(HorizontalLineElementFactory.createHorizontalLine(12, null, new BasicStroke(0.5f)));
    continentGroup.setHeader(header);

    final GroupFooter footer = new GroupFooter();
    footer.setName("Continent-Group-Footer");
    footer.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(20));
View Full Code Here

    this.shapes = createShapeList();
    this.fillShapes = new ArrayList();
    this.fillShapes.add(0, Boolean.TRUE);
    this.fillPaint = Color.black;
    this.outlineStroke = new BasicStroke(0.5f);
    recompute();
  }
View Full Code Here

  }

  protected void drawTickMarks(final Graphics2D g2, final Rectangle2D area)
  {
    g2.setPaint(getTickMarkPaint());
    g2.setStroke(new BasicStroke(0.1f));

    final int highest = getHighest();
    for (int i = getLowest(); i <= highest; i++)
    {
      for (int j = 0; j < 10; j++)
View Full Code Here

    }

    switch (type)
    {
      case STROKE_DASHED:
        return new BasicStroke(width, BasicStroke.CAP_SQUARE,
            BasicStroke.JOIN_MITER,
            10.0f, new float[]
                {6 * effectiveWidth, 6 * effectiveWidth}, 0.0f);
      case STROKE_DOTTED:
        return new BasicStroke(width, BasicStroke.CAP_SQUARE,
            BasicStroke.JOIN_MITER,
            5.0f, new float[]{0.0f, 2 * effectiveWidth}, 0.0f);
      case STROKE_DOT_DASH:
        return new BasicStroke(width, BasicStroke.CAP_SQUARE,
            BasicStroke.JOIN_MITER,
            10.0f, new float[]
                {0, 2 * effectiveWidth, 6 * effectiveWidth, 2 * effectiveWidth}, 0.0f);
      case STROKE_DOT_DOT_DASH:
        return new BasicStroke(width, BasicStroke.CAP_SQUARE,
            BasicStroke.JOIN_MITER,
            10.0f, new float[]{0, 2 * effectiveWidth,
                0, 2 * effectiveWidth,
                6 * effectiveWidth, 2 * effectiveWidth}, 0.0f);
      default:
        return new BasicStroke(width);
    }
  }
View Full Code Here

   */
  public static float getStrokeWidth(final Stroke s)
  {
    if (s instanceof BasicStroke)
    {
      final BasicStroke bs = (BasicStroke) s;
      return bs.getLineWidth();
    }
    return 1;
  }
View Full Code Here

  {
    if (s instanceof BasicStroke == false)
    {
      return STROKE_SOLID;
    }
    final BasicStroke bs = (BasicStroke) s;
    if (bs.getLineWidth() <= 0)
    {
      return STROKE_NONE;
    }

    final float[] dashes = bs.getDashArray();
    if (dashes == null)
    {
      return STROKE_SOLID;
    }
    if (dashes.length < 2)
    {
      return STROKE_SOLID;
    }
    if (dashes.length == 3 || dashes.length == 5)
    {
      return STROKE_SOLID;
    }

    if (dashes.length == 2)
    {
      // maybe dashed or dotted ...
//      if (dashes[0] < 2 && dashes[1] < 2) {
//        return STROKE_DOTTED;
//      }
      final float factor = dashes[0] / dashes[1];
      if (factor > 0.9 && factor < 1.1)
      {
        return STROKE_DASHED;
      }
      else if (factor < 0.1)
      {
        return STROKE_DOTTED;
      }

      // else ... not recognized ...
      return STROKE_SOLID;
    }
    else if (dashes.length == 4)
    {
      // maybe a dot-dashed stroke ...
      final float[] copyDashes = (float[]) dashes.clone();
      Arrays.sort(copyDashes);

      // the first value should be near zero ..
      if (Math.abs(copyDashes[0] / bs.getLineWidth()) > 0.5)
      {
        // not recognized ..
        return STROKE_SOLID;
      }

      // test that the first two values have the same size
      final float factor1 = (2 * bs.getLineWidth()) / copyDashes[1];
      final float factor2 = (2 * bs.getLineWidth()) / copyDashes[2];
      final float factorBig = (2 * bs.getLineWidth()) / copyDashes[3];

      if ((factor1 < 0.9 || factor1 > 1.1) ||
          (factor2 < 0.9 || factor2 > 1.1))
      {
        // not recognized ...
        return STROKE_SOLID;
      }

      if (factorBig < 0.4 || factorBig > 2.5)
      {
        return STROKE_DOT_DASH;
      }
      if (factorBig < 0.9 || factorBig > 1.1)
      {
        return STROKE_DOTTED;
      }
      return STROKE_DASHED;
    }
    else if (dashes.length == 6)
    {
      // maybe a dot-dashed stroke ...
      final float[] copyDashes = (float[]) dashes.clone();
      Arrays.sort(copyDashes);
      // test that the first three values have the same size

      // the first two values should be near zero ..
      if (Math.abs(copyDashes[0] / bs.getLineWidth()) > 0.5)
      {
        // not recognized ..
        return STROKE_SOLID;
      }
      if (Math.abs(copyDashes[1] / bs.getLineWidth()) > 0.5)
      {
        // not recognized ..
        return STROKE_SOLID;
      }

      final float factor2 = (2 * bs.getLineWidth()) / copyDashes[2];
      final float factor3 = (2 * bs.getLineWidth()) / copyDashes[3];
      final float factor4 = (2 * bs.getLineWidth()) / copyDashes[4];
      final float factorBig = (2 * bs.getLineWidth()) / copyDashes[5];

      if ((factor2 < 0.9 || factor2 > 1.1) ||
          (factor3 < 0.9 || factor3 > 1.1) ||
          (factor4 < 0.9 || factor4 > 1.1))
      {
View Full Code Here

                                         float thickness, boolean dashed) {
        Stroke stroke;
        if (dashed) {
            // create a basic default dash
            float[] dash = { 8.0f, 8.0f };
            stroke = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
        } else {
            stroke = new BasicStroke(thickness);
        }

        link.setStroke(stroke);
        link.setLinePaint(paint);
    }
View Full Code Here

TOP

Related Classes of java.awt.BasicStroke$DashIterator$Line

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.