Java Code Examples for javafx.scene.shape.Polygon#setStrokeWidth()

The following examples show how to use javafx.scene.shape.Polygon#setStrokeWidth() . 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: PolygonSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    Polygon polygon = new Polygon(new double[]{
        45 , 10 ,
        10 , 80 ,
        80 , 80 ,
    });
    polygon.setStroke(Color.web("#b9c0c5"));
    polygon.setStrokeWidth(5);
    polygon.getStrokeDashArray().addAll(15d,15d);
    polygon.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    polygon.setEffect(effect);
    return polygon;
}
 
Example 2
Source File: PolygonSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    Polygon polygon = new Polygon(new double[]{
        45 , 10 ,
        10 , 80 ,
        80 , 80 ,
    });
    polygon.setStroke(Color.web("#b9c0c5"));
    polygon.setStrokeWidth(5);
    polygon.getStrokeDashArray().addAll(15d,15d);
    polygon.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    polygon.setEffect(effect);
    return polygon;
}
 
Example 3
Source File: CreationMenuOnClickHandler.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private Node createArrow(final boolean left) {
	// shape
	final Polygon arrow = new Polygon();
	arrow.getPoints().addAll(left ? LEFT_ARROW_POINTS : RIGHT_ARROW_POINTS);
	// style
	arrow.setStrokeWidth(ARROW_STROKE_WIDTH);
	arrow.setStroke(ARROW_STROKE);
	arrow.setFill(ARROW_FILL);
	// effect
	effectOnHover(arrow, new DropShadow(DROP_SHADOW_RADIUS, getHighlightColor()));
	// action
	arrow.setOnMouseClicked(new EventHandler<MouseEvent>() {
		@Override
		public void handle(MouseEvent event) {
			traverse(left);
		}
	});
	return arrow;
}
 
Example 4
Source File: PolygonSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public PolygonSample() {
    super(180,90);
    // Simple red filled triangle
    Polygon polygon1 = new Polygon(new double[]{
        45 , 10 ,
        10 , 80 ,
        80 , 80 ,
    });
    polygon1.setFill(Color.RED);

    // Blue stroked polygon
    Polygon polygon2 = new Polygon(new double[]{
        135, 15,
        160, 30,
        160, 60,
        135, 75,
        110, 60,
        110, 30
    });
    polygon2.setStroke(Color.DODGERBLUE);
    polygon2.setStrokeWidth(2);
    polygon2.setFill(null);

    
    // Create a group to show all the polygons);
    getChildren().add(new Group(polygon1, polygon2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Polygon 1 Fill", polygon1.fillProperty()),
            new SimplePropertySheet.PropDesc("Polygon 2 Stroke", polygon2.strokeProperty())
    );
    // END REMOVE ME
}
 
Example 5
Source File: PolygonSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public PolygonSample() {
    super(180,90);
    // Simple red filled triangle
    Polygon polygon1 = new Polygon(new double[]{
        45 , 10 ,
        10 , 80 ,
        80 , 80 ,
    });
    polygon1.setFill(Color.RED);

    // Blue stroked polygon
    Polygon polygon2 = new Polygon(new double[]{
        135, 15,
        160, 30,
        160, 60,
        135, 75,
        110, 60,
        110, 30
    });
    polygon2.setStroke(Color.DODGERBLUE);
    polygon2.setStrokeWidth(2);
    polygon2.setFill(null);

    
    // Create a group to show all the polygons);
    getChildren().add(new Group(polygon1, polygon2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Polygon 1 Fill", polygon1.fillProperty()),
            new SimplePropertySheet.PropDesc("Polygon 2 Stroke", polygon2.strokeProperty())
    );
    // END REMOVE ME
}
 
Example 6
Source File: CameraIcon.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CameraIcon(ObservableEntity oe) {
    super(oe);

    int w = W/2;
    int h = H/2;
    shape = new Polygon(-w, -h, w, -h, w, h, -w, h);
    shape.setFill(Color.TRANSPARENT);
    shape.setStrokeWidth(20);
    shape.strokeProperty().bind(getPlayerColor());

    shape.translateXProperty().bind(getMapX().subtract(W/2));
    shape.translateYProperty().bind(getMapY().subtract(H));
}