当前位置: 首页>>代码示例>>Java>>正文


Java BasicStroke.JOIN_ROUND属性代码示例

本文整理汇总了Java中java.awt.BasicStroke.JOIN_ROUND属性的典型用法代码示例。如果您正苦于以下问题:Java BasicStroke.JOIN_ROUND属性的具体用法?Java BasicStroke.JOIN_ROUND怎么用?Java BasicStroke.JOIN_ROUND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.BasicStroke的用法示例。


在下文中一共展示了BasicStroke.JOIN_ROUND属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SynchronousXYItemPainter

public SynchronousXYItemPainter(float lineWidth, Color lineColor, Color fillColor,
                      int type, int maxValueOffset) {

    if (lineColor == null && fillColor == null)
        throw new IllegalArgumentException("No parameters defined"); // NOI18N

    this.lineWidth = (int)Math.ceil(lineWidth);
    this.lineColor = Utils.checkedColor(lineColor);
    this.fillColor = Utils.checkedColor(fillColor);

    this.lineStroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
                                      BasicStroke.JOIN_ROUND);

    this.type = type;
    this.maxValueOffset = maxValueOffset;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:SynchronousXYItemPainter.java

示例2: createDashedBorder

/**
 * Creates a dashed border of the specified {@code paint}, {@code thickness},
 * line shape, relative {@code length}, and relative {@code spacing}.
 * If the specified {@code paint} is {@code null},
 * the component's foreground color will be used to render the border.
 *
 * @param paint      the {@link Paint} object used to generate a color
 * @param thickness  the width of a dash line
 * @param length     the relative length of a dash line
 * @param spacing    the relative spacing between dash lines
 * @param rounded    whether or not line ends should be round
 * @return the {@code Border} object
 *
 * @throws IllegalArgumentException if the specified {@code thickness} is less than {@code 1}, or
 *                                  if the specified {@code length} is less than {@code 1}, or
 *                                  if the specified {@code spacing} is less than {@code 0}
 * @since 1.7
 */
public static Border createDashedBorder(Paint paint, float thickness, float length, float spacing, boolean rounded) {
    boolean shared = !rounded && (paint == null) && (thickness == 1.0f) && (length == 1.0f) && (spacing == 1.0f);
    if (shared && (sharedDashedBorder != null)) {
        return sharedDashedBorder;
    }
    if (thickness < 1.0f) {
        throw new IllegalArgumentException("thickness is less than 1");
    }
    if (length < 1.0f) {
        throw new IllegalArgumentException("length is less than 1");
    }
    if (spacing < 0.0f) {
        throw new IllegalArgumentException("spacing is less than 0");
    }
    int cap = rounded ? BasicStroke.CAP_ROUND : BasicStroke.CAP_SQUARE;
    int join = rounded ? BasicStroke.JOIN_ROUND : BasicStroke.JOIN_MITER;
    float[] array = { thickness * (length - 1.0f), thickness * (spacing + 1.0f) };
    Border border = createStrokeBorder(new BasicStroke(thickness, cap, join, thickness * 2.0f, array, 0.0f), paint);
    if (shared) {
        sharedDashedBorder = border;
    }
    return border;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:BorderFactory.java

示例3: DiscreteXYPainter

DiscreteXYPainter(float lineWidth, Color lineColor, Color fillColor,
                  int width, boolean fixedWidth, boolean topLineOnly,
                  boolean outlineOnly, double dataFactor, PointsComputer computer) {

    super((int)Math.ceil(lineWidth), fillColor != null ||
          (!topLineOnly && !outlineOnly), dataFactor);
    
    if (lineColor == null && fillColor == null)
        throw new IllegalArgumentException("lineColor or fillColor must not be null"); // NOI18N

    this.lineWidth = (int)Math.ceil(lineWidth);
    this.lineColor = Utils.checkedColor(lineColor);
    this.fillColor = Utils.checkedColor(fillColor);

    definingColor = lineColor != null ? lineColor : fillColor;

    this.lineStroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
                                      BasicStroke.JOIN_ROUND);

    this.width = width;
    this.fixedWidth = fixedWidth;
    this.topLineOnly = topLineOnly;
    this.outlineOnly = outlineOnly;

    this.computer = computer;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:DiscreteXYPainter.java

示例4: drawFiltArea

/**
 * Draw a semi-trasparent area that is the filtered area
 * @param g The graphic object
 * @param filteredArea The filtered area
 */
public void drawFiltArea(Graphics2D g, Area filtArea) {
	AffineTransform t = new AffineTransform();
	t.scale(scale / 100, scale / 100);
	AffineTransform t2 = new AffineTransform();
	t2.translate(tran_x, tran_y);

	filtArea.transform(t);
	filtArea.transform(t2);

	Stroke oldStro = g.getStroke();
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	g.setStroke(stroke);

	g.setColor(Color.gray);
	Composite oldComp = g.getComposite();
	Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
	g.setComposite(alphaComp);

	g.fill(filtArea);
	g.setComposite(oldComp);
	g.setStroke(oldStro);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:27,代码来源:PainterConvex2D.java

示例5: draw

protected static void draw(String name1, String name2, Graphics g, Rectangle bounds, Color fg, Color bg,
    Color sz, float lineWidth, String size) {

  if (bg != null) {
    g.setColor(bg);
    g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
  }

  g.setColor(fg);
  BasicStroke stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
  Graphics2D g2 = ((Graphics2D) g);
  g2.setStroke(stroke);
  //g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

  g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);

  g.setColor(sz);
  drawSize(g, size, bounds);

  g.setColor(fg);
  draw(g, lineWidth, name1, bounds, false);
  draw(g, lineWidth, name2, bounds, true);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:23,代码来源:Symbol.java

示例6: drawDragArea

/**
 * Draw a semi-trasparet area
 * @param g The graphic object
 * @param dragPoint The first point
 * @param beginPoint The second point
 * @param c The color of the area
 */
public void drawDragArea(Graphics2D g, Point dragPoint, Point beginPoint, Color c) {
	g.setColor(c);

	Polygon poly = new Polygon();

	poly.addPoint((int) beginPoint.getX(), (int) beginPoint.getY());
	poly.addPoint((int) beginPoint.getX(), (int) dragPoint.getY());
	poly.addPoint((int) dragPoint.getX(), (int) dragPoint.getY());
	poly.addPoint((int) dragPoint.getX(), (int) beginPoint.getY());

	//Set the widths of the shape's outline
	Stroke oldStro = g.getStroke();
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	g.setStroke(stroke);
	g.drawPolygon(poly);
	g.setStroke(oldStro);

	//Set the trasparency of the iside of the rectangle
	Composite oldComp = g.getComposite();
	Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f);
	g.setComposite(alphaComp);
	g.fillPolygon(poly);
	g.setComposite(oldComp);

}
 
开发者ID:max6cn,项目名称:jmt,代码行数:32,代码来源:PainterConvex2D.java

示例7: initDefaultValues

private void initDefaultValues() {
    markPaint = new Color(80, 80, 80);
    oddPerfPaint = Color.BLACK;
    evenPerfPaint = Color.WHITE;

    markStroke = new BasicStroke(2.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    oddPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 0);
    evenPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 2);

    selectionExtent = 3;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ProfilerXYSelectionOverlay.java

示例8: selectStylePen

protected boolean selectStylePen(int cap, int join, float width,
                                 Color color) {

    long endCap;
    long lineJoin;

    float[] rgb = color.getRGBColorComponents(null);

    switch(cap) {
    case BasicStroke.CAP_BUTT: endCap = PS_ENDCAP_FLAT; break;
    case BasicStroke.CAP_ROUND: endCap = PS_ENDCAP_ROUND; break;
    default:
    case BasicStroke.CAP_SQUARE: endCap = PS_ENDCAP_SQUARE; break;
    }

    switch(join) {
    case BasicStroke.JOIN_BEVEL:lineJoin = PS_JOIN_BEVEL; break;
    default:
    case BasicStroke.JOIN_MITER:lineJoin = PS_JOIN_MITER; break;
    case BasicStroke.JOIN_ROUND:lineJoin = PS_JOIN_ROUND; break;
    }

    return (selectStylePen(getPrintDC(), endCap, lineJoin, width,
                           (int) (rgb[0] * MAX_WCOLOR),
                           (int) (rgb[1] * MAX_WCOLOR),
                           (int) (rgb[2] * MAX_WCOLOR)));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:WPrinterJob.java

示例9: createStroke

private static BasicStroke createStroke(final float width,
                                        final boolean useDashes,
                                        final float dashMinLen) {
    final float[] dashes;

    if (useDashes) {
        // huge dash array (exceed Dasher.INITIAL_ARRAY)
        dashes = new float[512];

        float cur = dashMinLen;
        float step = 0.01f;

        for (int i = 0; i < dashes.length; i += 2) {
            dashes[i] = cur;
            dashes[i + 1] = cur;
            cur += step;
        }
    } else {
        dashes = null;
    }

    if (USE_ROUND_CAPS_AND_JOINS) {
        // Use both round Caps & Joins:
        return new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 100.0f, dashes, 0.0f);
    }
    return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 100.0f, dashes, 0.0f);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:CrashTest.java

示例10: draw

public void draw(Graphics2D g2d, Shape s, double scale) {

    if ((color != null && opacity > 0 ) || STYLE_IMAGE.equals(style)) {
      final Stroke oldStroke = g2d.getStroke();
      final Color oldColor = g2d.getColor();
      final Composite oldComposite = g2d.getComposite();
      final Paint oldPaint = g2d.getPaint();
      if (!STYLE_PLAIN.equals(style)) {
        g2d.setPaint(getPaint());
      }
      else {
        g2d.setColor(color);
      }

      g2d.setComposite(AlphaComposite.getInstance(
        AlphaComposite.SRC_OVER, opacity/100.0f));
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                           RenderingHints.VALUE_ANTIALIAS_ON);

      if (COVERAGE_FULL.equals(coverage)) {
        g2d.fill(s);
      }
      else {
        final Stroke stroke = new BasicStroke((float)(width*scale),
                                              BasicStroke.CAP_ROUND,
                                              BasicStroke.JOIN_ROUND);
        g2d.setStroke(stroke);
        g2d.draw(s);
      }

      g2d.setColor(oldColor);
      g2d.setStroke(oldStroke);
      g2d.setComposite(oldComposite);
      g2d.setPaint(oldPaint);
    }
  }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:36,代码来源:ZoneHighlight.java

示例11: buildStroke

protected void buildStroke(double zoom) {
  stroke = new BasicStroke((float) Math.min(borderWidth * zoom, 1.0),
                           BasicStroke.CAP_ROUND,
                           BasicStroke.JOIN_ROUND);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:5,代码来源:MapShader.java

示例12: ContinuousXYPainter

ContinuousXYPainter(float lineWidth, Color lineColor, Color fillColor,
                    double dataFactor, PointsComputer computer) {

    super((int)Math.ceil(lineWidth), fillColor != null, dataFactor);

    if (lineColor == null && fillColor == null)
        throw new IllegalArgumentException("lineColor or fillColor must not be null"); // NOI18N

    this.lineWidth = (int)Math.ceil(lineWidth);
    this.lineColor = Utils.checkedColor(lineColor);
    this.fillColor = Utils.checkedColor(fillColor);

    definingColor = lineColor != null ? lineColor : fillColor;

    this.lineStroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
                                      BasicStroke.JOIN_ROUND);

    this.computer = computer;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ContinuousXYPainter.java

示例13: drawSelectLine

/**
 * Draw the selected line of the convex hull 
 * and the information about it
 * @param g Graphic object
 * @param p1 The first point of the line
 * @param p2 The second point of the line
 * @param s3d Information aboute the classes
 * @param classNames The name of the classes
 */
public void drawSelectLine(Graphics2D g, DPoint p1, DPoint p2, Vector<Object> s3d, String[] classNames) {
	if ((p1 != null) && (p2 != null)) {
		//Draw the selected line
		Stroke oldStro = g.getStroke();
		Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
		g.setStroke(stroke);
		g.setColor(Color.black);
		g.drawLine((int) (p1.getX() * scale) + tran_x, tran_y - (int) (p1.getY() * scale), (int) (p2.getX() * scale) + tran_x, tran_y
				- (int) (p2.getY() * scale));
		g.setStroke(oldStro);

		//Set the middle point
		int x = (int) p2.getX() + (int) ((p1.getX() - p2.getX()) / 2);
		int y = (int) p2.getY() + (int) ((p1.getY() - p2.getY()) / 2);
		x = (int) (x * scale) + tran_x + (pointSize + 3);
		y = tran_y - (int) (y * scale) - (pointSize + 1);

		Font label = new Font("Arial", Font.PLAIN, 7 + pointSize);
		g.setFont(label);

		//Draw the label
		for (int i = 0; i < s3d.size(); i++) {
			// Current sector
			FinalSect2D sect = (FinalSect2D) s3d.get(i);
			String pb11 = format2Dec.format(sect.getBeta11() * 100);
			String pb12 = format2Dec.format(sect.getBeta1() * 100);
			String pb21 = format2Dec.format(sect.getBeta22() * 100);
			String pb22 = format2Dec.format(sect.getBeta2() * 100);

			if (sect.countStation() < 2) {
				continue;
			}

			Station2D d1 = (sect.getstation()).get(0);
			Station2D d2 = (sect.getstation()).get(1);
			int d1x = (int) (d1.getVert()).getX();
			int d1y = (int) (d1.getVert()).getY();
			int d2x = (int) (d2.getVert()).getX();
			int d2y = (int) (d2.getVert()).getY();
			int p1x = (int) (p1.getX() * 100);
			int p1y = (int) (p1.getY() * 100);
			int p2x = (int) (p2.getX() * 100);
			int p2y = (int) (p2.getY() * 100);
			double t1 = ((p1.getY() - p2.getY()) / ((p2.getX() * p1.getY()) - (p1.getX() * p2.getY())));
			double t2 = ((p2.getX() - p1.getX()) / ((p2.getX() * p1.getY()) - (p1.getX() * p2.getY())));

			if (((d1x == p1x) && (d1y == p1y) && (d2x == p2x) && (d2y == p2y)) || ((d1x == p2x) && (d1y == p2y) && (d2x == p1x) && (d2y == p1y))) {
				g.drawString(classNames[0] + "=" + format4Dec.format(t1) + " job/sec", x, y - (8 + pointSize));
				g.drawString(classNames[1] + "=" + format4Dec.format(t2) + " job/sec", x, y);

				g.drawString(classNames[1] + "% [" + pb22 + "," + pb12 + "]", x, y - 2 * (8 + pointSize));
				g.drawString(classNames[0] + "% [" + pb21 + "," + pb11 + "]", x, y - 3 * (8 + pointSize));
				break;
			}
		}
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:66,代码来源:PainterConvex2D.java

示例14: getAnotherObject

protected BasicStroke getAnotherObject() {
    float[] f = {1.0f, 2.0f, 3.0f, 4.0f};
    return new BasicStroke(f[1], BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, f[2], f, f[3]);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:java_awt_BasicStroke.java

示例15: getLongDashedStroke

static public BasicStroke getLongDashedStroke() {
	return new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 10.0f, new float[] { 7f, 3f }, 0.0f);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:3,代码来源:LineFormat.java


注:本文中的java.awt.BasicStroke.JOIN_ROUND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。