javafx.scene.shape.Shape#setTranslateX ( )源码实例Demo

下面列出了javafx.scene.shape.Shape#setTranslateX ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FXTutorials   文件: MKXMenuApp.java
public TriCircle() {
    Shape shape1 = Shape.subtract(new Circle(5), new Circle(2));
    shape1.setFill(Color.WHITE);

    Shape shape2 = Shape.subtract(new Circle(5), new Circle(2));
    shape2.setFill(Color.WHITE);
    shape2.setTranslateX(5);

    Shape shape3 = Shape.subtract(new Circle(5), new Circle(2));
    shape3.setFill(Color.WHITE);
    shape3.setTranslateX(2.5);
    shape3.setTranslateY(-5);

    getChildren().addAll(shape1, shape2, shape3);

    setEffect(new GaussianBlur(2));
}
 
源代码2 项目: DevToolBox   文件: Piece.java
private Shape createPiece() {
    Shape shape = createPieceRectangle();
    if (hasRightTab) {
        shape = Shape.union(shape,
                createPieceTab(69.5f, 0f, 10f, 17.5f, 50f, -12.5f, 11.5f,
                        25f, 56.25f, -14f, 6.25f, 56.25f, 14f, 6.25f));
    }
    if (hasBottomTab) {
        shape = Shape.union(shape,
                createPieceTab(0f, 69.5f, 17.5f, 10f, -12.5f, 50f, 25f,
                        11f, -14f, 56.25f, 6.25f, 14f, 56.25f, 6.25f));
    }
    if (hasLeftTab) {
        shape = Shape.subtract(shape,
                createPieceTab(-31f, 0f, 10f, 17.5f, -50f, -12.5f, 11f,
                        25f, -43.75f, -14f, 6.25f, -43.75f, 14f, 6.25f));
    }
    if (hasTopTab) {
        shape = Shape.subtract(shape,
                createPieceTab(0f, -31f, 17.5f, 10f, -12.5f, -50f, 25f,
                        12.5f, -14f, -43.75f, 6.25f, 14f, -43.75f, 6.25f));
    }
    shape.setTranslateX(correctX);
    shape.setTranslateY(correctY);
    shape.setLayoutX(50f);
    shape.setLayoutY(50f);
    return shape;
}
 
源代码3 项目: gef   文件: DotArrowShapeDecorations.java
/**
 * Returns the dot arrow shape decoration corresponding to the
 * <i>arrowType</i> parameter.
 *
 * @param arrowType
 *            The arrow type for which the dot edge decoration should be
 *            determined.
 *
 * @param arrowSize
 *            The size of the arrow shape decoration.
 *
 * @param penwidth
 *            The (pen)width of the shape's drawn lines.
 *
 * @param color
 *            The color to use for the arrow shape decoration outline.
 *
 * @param fillColor
 *            The color to use for the arrow shape decoration background.
 *
 * @return The dot arrow shape decoration.
 */
static Node get(ArrowType arrowType, double arrowSize, Double penwidth,
		String color, String fillColor) {
	// The first arrow shape specified should occur closest to the node.
	double offset = 0.0;
	Group group = new Group();
	for (AbstractArrowShape arrowShape : arrowType.getArrowShapes()) {
		Shape currentShape = get(arrowShape, arrowSize, penwidth, color,
				fillColor);
		if (currentShape == null) {
			// represent the "none" arrow shape with a transparent box with
			// the corresponding size
			currentShape = new Box(arrowSize);
			currentShape.setFill(Color.TRANSPARENT);
			currentShape.setTranslateX(offset);
		} else {
			if (currentShape instanceof Circle) {
				// translate a circle-based shape specially because of its
				// middle-point-based translation
				currentShape.setTranslateX(offset
						+ currentShape.getLayoutBounds().getWidth() / 2);
			} else {
				currentShape.setTranslateX(offset);
			}
		}
		offset += NodeUtils.getShapeBounds(currentShape).getWidth()
				- currentShape.getStrokeWidth();
		group.getChildren().add(currentShape);
	}

	return group;
}