Java Code Examples for javafx.scene.shape.Shape#setTranslateX()
The following examples show how to use
javafx.scene.shape.Shape#setTranslateX() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MKXMenuApp.java From FXTutorials with MIT License | 6 votes |
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)); }
Example 2
Source File: Piece.java From DevToolBox with GNU Lesser General Public License v2.1 | 5 votes |
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; }
Example 3
Source File: DotArrowShapeDecorations.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * 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; }