Package java.awt

Examples of java.awt.BasicStroke$Dasher


        Graphics2D g2 = (Graphics2D) g.create();
        //shift the image for pressed buttons
        if (getModel().isPressed()) {
          g2.translate(1, 1);
        }
        g2.setStroke(new BasicStroke(2));
        g2.setColor(Color.BLACK);
        if (!isEnabled()) {
          g2.setColor(Color.GRAY);
        }
        if (getModel().isRollover()) {
View Full Code Here


    }
   
    private void drawCircuit(Graphics g, int x0, int y0) {
      if (g instanceof Graphics2D) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setStroke(new BasicStroke(5.0f));
      }
      drawWires(g, x0, y0);
      g.setColor(gateColor);
      drawNot(g, x0, y0, 70, 10);
      drawNot(g, x0, y0, 70, 110);
View Full Code Here

      Stroke str = grp.getStroke();
      Color col = grp.getColor();
      float[] dash = { 2.0f };
      int lineWidth = 1;
      BasicStroke dashed = new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
          BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
      grp.setColor(Color.BLACK);
      grp.setStroke(dashed);

      grp.drawRect(lineWidth - 1, lineWidth - 1, width - lineWidth, height - lineWidth);
View Full Code Here

            final XYLine3DRenderer renderer = new XYLine3DRenderer();
            renderer.setDrawOutlines(true);
            renderer.setLinesVisible(true);
            renderer.setShapesVisible(true);
            renderer.setStroke(new BasicStroke(2));
            renderer.setXOffset(1);
            renderer.setYOffset(1);
            chart.getXYPlot().setRenderer(renderer);
        }
View Full Code Here

        PdfContentByte cb = _currentPage;
        if (newStroke == oldStroke)
            return;
        if (!(newStroke instanceof BasicStroke))
            return;
        BasicStroke nStroke = (BasicStroke)newStroke;
        boolean oldOk = (oldStroke instanceof BasicStroke);
        BasicStroke oStroke = null;
        if (oldOk)
            oStroke = (BasicStroke)oldStroke;
        if (!oldOk || nStroke.getLineWidth() != oStroke.getLineWidth())
            cb.setLineWidth(nStroke.getLineWidth());
        if (!oldOk || nStroke.getEndCap() != oStroke.getEndCap()) {
            switch (nStroke.getEndCap()) {
            case BasicStroke.CAP_BUTT:
                cb.setLineCap(0);
                break;
            case BasicStroke.CAP_SQUARE:
                cb.setLineCap(2);
                break;
            default:
                cb.setLineCap(1);
            }
        }
        if (!oldOk || nStroke.getLineJoin() != oStroke.getLineJoin()) {
            switch (nStroke.getLineJoin()) {
            case BasicStroke.JOIN_MITER:
                cb.setLineJoin(0);
                break;
            case BasicStroke.JOIN_BEVEL:
                cb.setLineJoin(2);
                break;
            default:
                cb.setLineJoin(1);
            }
        }
        if (!oldOk || nStroke.getMiterLimit() != oStroke.getMiterLimit())
            cb.setMiterLimit(nStroke.getMiterLimit());
        boolean makeDash;
        if (oldOk) {
            if (nStroke.getDashArray() != null) {
                if (nStroke.getDashPhase() != oStroke.getDashPhase()) {
                    makeDash = true;
                }
                else if (!java.util.Arrays.equals(nStroke.getDashArray(), oStroke.getDashArray())) {
                    makeDash = true;
                }
                else
                    makeDash = false;
            }
            else if (oStroke.getDashArray() != null) {
                makeDash = true;
            }
            else
                makeDash = false;
        }
View Full Code Here

    }
   
    private Stroke transformStroke(Stroke stroke) {
        if (!(stroke instanceof BasicStroke))
            return stroke;
        BasicStroke st = (BasicStroke)stroke;
        float scale = (float)Math.sqrt(Math.abs(_transform.getDeterminant()));
        float dash[] = st.getDashArray();
        if (dash != null) {
            for (int k = 0; k < dash.length; ++k)
                dash[k] *= scale;
        }
        return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
    }
View Full Code Here

    final String lineWidth = result1.getProperty("lineWidth");
    if (lineWidth != null)
    {
      final float lineWidthf = ParserUtil.parseFloat(lineWidth, "Failed to parse lineWidth", getLocator());
      element.getStyle().setStyleProperty(ElementStyleKeys.STROKE, new BasicStroke(lineWidthf));
    }

    final String drawBorder = result1.getProperty("direction");
    if (drawBorder != null)
    {
View Full Code Here

  {

    final float width = getFloatParameter("value");
    if (width > 0)
    {
      return new BasicStroke(width);
    }

    final Float realWidth = (Float) getParameter("width");
    final Float[] dashes = (Float[]) getParameter("dashes");
    if (realWidth == null || dashes == null)
    {
      return null;
    }
    final float[] dashesPrimitive = new float[dashes.length];
    for (int i = 0; i < dashes.length; i++)
    {
      final Float dash = dashes[i];
      dashesPrimitive[i] = dash.floatValue();
    }
    return new BasicStroke(realWidth.floatValue(),
        BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER,
        10.0f, dashesPrimitive, 0.0f);
  }
View Full Code Here

  {
    if (!(o instanceof BasicStroke))
    {
      throw new ObjectFactoryException("Expected object of type BasicStroke");
    }
    final BasicStroke bs = (BasicStroke) o;
    setParameter("value", String.valueOf(bs.getLineWidth()));
  }
View Full Code Here

    else
    {
      dash = null;
    }

    stroke = new BasicStroke(width, cap, join, miterLimit, dash, dashPhase);
  }
View Full Code Here

TOP

Related Classes of java.awt.BasicStroke$Dasher

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.