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


Java Path.setStrokeWidth方法代码示例

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


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

示例1: createIconContent

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public static Node createIconContent() {
    Path path = new Path();
           path.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(45),
            new ArcTo(20, 20, 0, 80, 25, true, true)
            );
    path.setStroke(Color.web("#b9c0c5"));
    path.setStrokeWidth(5);
    path.getStrokeDashArray().addAll(15d,15d);
    path.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));
    path.setEffect(effect);
    return path;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:PathSample.java

示例2: generateOutline

import javafx.scene.shape.Path; //导入方法依赖的package包/类
/**
 * Once we have drawn the path, we call this method to generate two paths 
 * (outer and inner paths) and get a SVGPath with them that can be exported
 * @param drawPath The original path
 * @param svg
 * @return the content string of the SVGPath with two paths
 */
public boolean generateOutline(Path drawPath, SVGPath svg) {
    Pane pane = (Pane) drawPath.getParent();
    final double width = pane.getWidth() * WIDTH_FACTOR; 
    
    Path outterPath = new Path(drawPath.getElements());
    outterPath.setStroke(drawPath.getStroke());
    outterPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    outterPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    outterPath.setStrokeWidth(width);
    Path s1 = (Path) Shape.subtract(outterPath, new Rectangle(0, 0));

    Path innerPath = new Path(drawPath.getElements());
    innerPath.setStrokeWidth(0);
    innerPath.setStroke(drawPath.getStroke());
    innerPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    innerPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    Path s2 = (Path) Shape.subtract(innerPath, new Rectangle(0, 0));
    
    Path result = (Path) Shape.subtract(s1, s2);
    clearSmallPolygons(result);
    svg.setContent(pathsToSVGPath());
    return validPaths.size() == 2;
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:31,代码来源:BadgeOutline.java

示例3: applyTransition

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public void applyTransition(Node node) {
    PathTransition pathTransition = new PathTransition();
    timeline = pathTransition;

    path = (Path) drawPath(140.0, 140.0, 0);
    path.setStrokeWidth(2);
    path.setStroke(Color.RED);

    path.setFill(Color.TRANSPARENT);

    pathTransition.setDuration(Duration.millis(motionDuration));
    pathTransition.setNode(node);
    //pathTransition.setPath(AnimationPath.createFromPath(path));
    pathTransition.setPath(path);
    pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:ContentMotion.java

示例4: drawNode

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public Node drawNode() {
    currentTestNode = this;
    PathTransition pathTransition = new PathTransition();
    Pane p = pre(pathTransition);

    Path path = createPath();
    path.setStrokeWidth(2);
    path.setStroke(Color.RED);
    p.getChildren().add(path);
    path.setFill(Color.TRANSPARENT);

    pathTransition.setDuration(Duration.millis(typicalDuration));
    pathTransition.setNode(circle);
    //pathTransition.setPath(AnimationPath.createFromPath(path));
    pathTransition.setPath(path);
    pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT);

    timeline.setCycleCount(3);
    timeline.setAutoReverse(true);

    return p;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:AnimationTransitionApp.java

示例5: start

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	Path shape = new Path(new MoveTo(450, 450),
               new LineTo(-SIZE, -SIZE),
               new LineTo(0, -2 * SIZE),
               new LineTo(SIZE, -SIZE),
               new LineTo(450, 450),
               new ClosePath());

	shape.setFill(Color.BLUE);
	shape.setStroke(Color.RED);
	shape.setStrokeWidth(2.0);
	shape.getStrokeDashArray().addAll(10.0, 5.0);

	Pane root = new Pane();
	root.getChildren().add(shape);

	stage.setScene(new Scene(root, 900, 900));
	stage.show();
}
 
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:21,代码来源:ShapeOutlineBugRectangle.java

示例6: Draw

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double width = canvas.getWidth() * (GetDoubleAttribute("Width") / (double) MaximumX);
	double height = GetDoubleAttribute("Height") == 0
			? width
			: canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY);
	double left = canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX) - width / 2;
	double top = canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY) - height / 2;
	Path path = new Path(new PathElement[]
	{
		new MoveTo(0, height / 2),
		new LineTo(width / 2, 0),
		new LineTo(width, height / 2),
		new LineTo(width / 2, height),
		new LineTo(0, height / 2)
	});
	path.setFill(GetColorAttribute("Color"));
	path.setStrokeWidth(0);
	path.setLayoutX(left);
	path.setLayoutY(top);
	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:24,代码来源:OverlayDiamond.java

示例7: Draw

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;
	double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;

	Path path = new Path(new PathElement[]
	{
		new MoveTo(widthX, 0),
		new LineTo(0, 0),
		new LineTo(0, widthY),
		new LineTo(canvas.getWidth() - widthX, canvas.getHeight()),
		new LineTo(canvas.getWidth(), canvas.getHeight()),
		new LineTo(canvas.getWidth(), canvas.getHeight() - widthY),
		new LineTo(widthX, 0)
	});
	path.setFill(GetColorAttribute("Color"));
	path.setStrokeWidth(0);
	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:21,代码来源:OverlayFimbriationBackward.java

示例8: Draw

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;
	double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;

	Path path = new Path(new PathElement[]
	{
		new MoveTo(canvas.getWidth() - widthX, 0),
		new LineTo(canvas.getWidth(), 0),
		new LineTo(canvas.getWidth(), widthY),
		new LineTo(widthX, canvas.getHeight()),
		new LineTo(0, canvas.getHeight()),
		new LineTo(0, canvas.getHeight() - widthY),
		new LineTo(canvas.getWidth() - widthX, 0)
	});
	path.setFill(GetColorAttribute("Color"));
	path.setStrokeWidth(0);
	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:21,代码来源:OverlayFimbriationForward.java

示例9: start

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("java-buddy.blogspot.com");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
     
    label = new Label("Wait mouse");
     
    path = new Path();
    path.setStrokeWidth(1);
    path.setStroke(Color.BLACK);
     
     
    scene.setOnMouseClicked(mouseHandler);
    scene.setOnMouseDragged(mouseHandler);
    scene.setOnMouseEntered(mouseHandler);
    scene.setOnMouseExited(mouseHandler);
    scene.setOnMouseMoved(mouseHandler);
    scene.setOnMousePressed(mouseHandler);
    scene.setOnMouseReleased(mouseHandler);
 
    root.getChildren().add(label);
    root.getChildren().add(path);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:27,代码来源:JavaFX_MouseEvent.java

示例10: PathSample

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public PathSample() {
    super(180,90);
    // Create path shape - square
    Path path1 = new Path();
    path1.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(65),
            new VLineTo(65),
            new LineTo(25, 65),
            new ClosePath()         
            );
    path1.setFill(null);
    path1.setStroke(Color.RED);
    path1.setStrokeWidth(2);

    // Create path shape - curves
    Path path2 = new Path();
    path2.getElements().addAll(
            new MoveTo(100, 45),
            new CubicCurveTo(120, 20, 130, 80, 140, 45),
            new QuadCurveTo(150, 0, 160, 45),
            new ArcTo(20, 40, 0, 180, 45, true, true)
            );
    path2.setFill(null);
    path2.setStroke(Color.DODGERBLUE);
    path2.setStrokeWidth(2);

    // show the path shapes;
    getChildren().add(new Group(path1, path2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()),
            new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty())
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:37,代码来源:PathSample.java

示例11: getHatching

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Shape getHatching(int length, int offset) {
	final Path p = new Path();
	for (int i = 0; i < (length / 2.5) + 1; i++) {
		final double x1 = (i - 1) * 2.5 + offset;
		final double y1 = 8;
		final double x2 = (i + 1) * 2.5 + offset;
		final double y2 = 0;
		final MoveTo move = new MoveTo(x1, y1);
		final LineTo line = new LineTo(x2, y2);
		p.getElements().addAll(move, line);
		p.setStrokeWidth(1);
	}
	return p;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:15,代码来源:ValueView.java

示例12: Sketch

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public Sketch(){
    //TODO, should this make a copy of the path?
    path = new Path();
    stroke = new Stroke();
    path.toFront();
    path.setStrokeWidth(2);
    path.setStroke(Color.BLACK);
    id = ++objectCount;
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:10,代码来源:Sketch.java

示例13: showError

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private void showError(int i, int j) {
    Path collisionPath1 = new Path();
    collisionPath1.getElements().add(new MoveTo(getPoint(i).getX(), getPoint(i).getY()));
    collisionPath1.getElements().add(new LineTo(getPoint(i + 1).getX(), getPoint(i + 1).getY()));
    collisionPath1.setStroke(Color.RED);
    collisionPath1.setStrokeWidth(5);
    drawPane.getChildren().add(collisionPath1);
    Path collisionPath2 = new Path();
    collisionPath2.getElements().add(new MoveTo(getPoint(j).getX(), getPoint(j).getY()));
    collisionPath2.getElements().add(new LineTo(getPoint(j + 1).getX(), getPoint(j + 1).getY()));
    collisionPath2.setStroke(Color.RED);
    collisionPath2.setStrokeWidth(5);
    drawPane.getChildren().add(collisionPath2);
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:15,代码来源:BadgePresenter.java

示例14: initGraphics

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    graphBounds = new Rectangle(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.45);

    titleText = new Text(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(String.format(locale, formatString, gauge.getValue()));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText = new Text(gauge.getUnit());
    unitText.setFill(gauge.getUnitColor());
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    averageText = new Text(String.format(locale, formatString, gauge.getAverage()));
    averageText.setFill(gauge.getAverageColor());
    Helper.enableNode(averageText, gauge.isAverageVisible());

    highText = new Text();
    highText.setTextOrigin(VPos.BOTTOM);
    highText.setFill(gauge.getValueColor());

    lowText = new Text();
    lowText.setTextOrigin(VPos.TOP);
    lowText.setFill(gauge.getValueColor());

    subTitleText = new Text(gauge.getSubTitle());
    subTitleText.setTextOrigin(VPos.TOP);
    subTitleText.setFill(gauge.getSubTitleColor());

    stdDeviationArea = new Rectangle();
    Helper.enableNode(stdDeviationArea, gauge.isAverageVisible());

    averageLine = new Line();
    averageLine.setStroke(gauge.getAverageColor());
    averageLine.getStrokeDashArray().addAll(PREFERRED_WIDTH * 0.005, PREFERRED_WIDTH * 0.005);
    Helper.enableNode(averageLine, gauge.isAverageVisible());

    pathElements = new ArrayList<>(noOfDatapoints);
    pathElements.add(0, new MoveTo());
    for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }

    sparkLine = new Path();
    sparkLine.getElements().addAll(pathElements);
    sparkLine.setFill(null);
    sparkLine.setStroke(gauge.getBarColor());
    sparkLine.setStrokeWidth(PREFERRED_WIDTH * 0.0075);
    sparkLine.setStrokeLineCap(StrokeLineCap.ROUND);
    sparkLine.setStrokeLineJoin(StrokeLineJoin.ROUND);

    dot = new Circle();
    dot.setFill(gauge.getBarColor());

    pane = new Pane(titleText, valueText, unitText, stdDeviationArea, averageLine, sparkLine, dot, averageText, highText, lowText, subTitleText);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:71,代码来源:TileSparklineSkin.java

示例15: Draw

import javafx.scene.shape.Path; //导入方法依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double thickness = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2;

	// Prevent the border from overlapping itself
	if (canvas.getWidth() - thickness * 2 < 0)
	{
		thickness = canvas.getWidth() / 2;
	}
	if (canvas.getHeight() - thickness * 2 < 0)
	{
		thickness = canvas.getHeight() / 2;
	}

	Path path = new Path(new PathElement[]
	{
		new MoveTo(0, 0),
		new LineTo(canvas.getWidth(), 0),
		new LineTo(canvas.getWidth(), canvas.getHeight()),
		new LineTo(0, canvas.getHeight()),
		new LineTo(0, 0),
		new MoveTo(thickness, thickness),
		new LineTo(thickness, canvas.getHeight() - thickness),
		new LineTo(canvas.getWidth() - thickness, canvas.getHeight() - thickness),
		new LineTo(canvas.getWidth() - thickness, thickness),
		new LineTo(thickness, thickness)
	});
	path.setFill(GetColorAttribute("Color"));
	path.setStrokeWidth(0);

	canvas.getChildren().add(path);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:34,代码来源:OverlayBorder.java


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