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


Java Path.setStroke方法代码示例

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


在下文中一共展示了Path.setStroke方法的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: bindToColor

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public void bindToColor(final ObjectProperty<Color> color, final ObjectProperty<Color.Intensity> intensity, final boolean doColorBackground) {
    final BiConsumer<Color, Color.Intensity> recolor = (newColor, newIntensity) -> {

        final JFXTextField textField = (JFXTextField) lookup("#textField");
        textField.setUnFocusColor(TRANSPARENT);
        textField.setFocusColor(newColor.getColor(newIntensity));

        if (doColorBackground) {
            final Path shape = (Path) lookup("#shape");
            shape.setFill(newColor.getColor(newIntensity.next(-1)));
            shape.setStroke(newColor.getColor(newIntensity.next(-1).next(2)));

            textField.setStyle("-fx-prompt-text-fill: rgba(255, 255, 255, 0.6); -fx-text-fill: " + newColor.getTextColorRgbaString(newIntensity) + ";");
            textField.setFocusColor(newColor.getTextColor(newIntensity));
        } else {
            textField.setStyle("-fx-prompt-text-fill: rgba(0, 0, 0, 0.6);");
        }

    };

    color.addListener(observable -> recolor.accept(color.get(), intensity.get()));
    intensity.addListener(observable -> recolor.accept(color.get(), intensity.get()));

    recolor.accept(color.get(), intensity.get());
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:26,代码来源:TagPresentation.java

示例3: initializeHalfCircle

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Path initializeHalfCircle() {
    final Path halfCircle = new Path();

    halfCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(CIRCLE_RADIUS);
    p2.setRadiusY(CIRCLE_RADIUS);

    halfCircle.getElements().add(p1);
    halfCircle.getElements().add(p2);

    return halfCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:HandshakeChannelSenderArrowHead.java

示例4: initializeLargeCircle

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Path initializeLargeCircle() {
    final Path largeCircle = new Path();

    largeCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(LARGE_CIRCLE_RADIUS);
    p2.setRadiusY(LARGE_CIRCLE_RADIUS);

    largeCircle.getElements().add(p1);
    largeCircle.getElements().add(p2);

    return largeCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例5: initializeMediumCircle

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Path initializeMediumCircle() {
    final Path mediumCircle = new Path();

    mediumCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(MEDIUM_CIRCLE_RADIUS);
    p2.setRadiusY(MEDIUM_CIRCLE_RADIUS);

    mediumCircle.getElements().add(p1);
    mediumCircle.getElements().add(p2);

    return mediumCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例6: initializeSmallCircle

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Path initializeSmallCircle() {
    final Path smallCircle = new Path();

    smallCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(SMALL_CIRCLE_RADIUS);
    p2.setRadiusY(SMALL_CIRCLE_RADIUS);

    smallCircle.getElements().add(p1);
    smallCircle.getElements().add(p2);

    return smallCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例7: 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

示例8: TestTextFlowWindow

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public TestTextFlowWindow()
{
	super("TestTextFlowWindow");
	
	setTitle("TextFlow Test");
	setSize(600, 200);
	
	info = new Text();
	
	highlight = new Path();
	highlight.setManaged(false);
	highlight.setStroke(null);
	highlight.setFill(Color.YELLOW);
	
	caret = new Path();
	caret.setManaged(false);
	caret.setStroke(Color.BLACK);
	
	setTop(tf());
	setBottom(new CTextFlow(info));
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:22,代码来源:TestTextFlowApp.java

示例9: 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

示例10: updateNodeColors

import javafx.scene.shape.Path; //导入方法依赖的package包/类
void updateNodeColors() {
			// Set the colors, if we can
			if (series.getNode() != null && (colorStroke != null || colorFill != null)) {
				try {
					Group group = (Group)series.getNode();
					Path seriesLine = (Path)group.getChildren().get(1);
					Path fillPath = (Path)group.getChildren().get(0);
					seriesLine.setStroke(colorStroke);
					fillPath.setFill(colorFill);
					
//					for (Data<Number, Number> item : series.getData()) {
//						if (item.getNode() != null) {
//							item.getNode().setStyle("fx-fill: red");
//						}
//					}
					
//					if (group.getChildren().size() > 2) {
//						System.err.println(group.getChildren());
//					}
				} catch (Exception e) {
					logger.error("Failed to set colors for series {}", series);
				}
			}
		}
 
开发者ID:qupath,项目名称:qupath,代码行数:25,代码来源:HistogramPanelFX.java

示例11: 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

示例12: Desk

import javafx.scene.shape.Path; //导入方法依赖的package包/类
Desk(int numOfColumns, int numOfRows) {
    setStyle("-fx-background-color: #cccccc; " +
            "-fx-border-color: #464646; " +
            "-fx-effect: innershadow( two-pass-box , rgba(0,0,0,0.8) , 15, 0.0 , 0 , 4 );");
    double DESK_WIDTH = Piece.SIZE * numOfColumns;
    double DESK_HEIGHT = Piece.SIZE * numOfRows;
    setPrefSize(DESK_WIDTH,DESK_HEIGHT);
    setMaxSize(DESK_WIDTH, DESK_HEIGHT);
    autosize();
    // create path for lines
    Path grid = new Path();
    grid.setStroke(Color.rgb(70, 70, 70));
    getChildren().add(grid);
    // create vertical lines
     for (int col = 0; col < numOfColumns - 1; col++) {
         grid.getElements().addAll(
             new MoveTo(Piece.SIZE + Piece.SIZE * col, 5),
             new LineTo(Piece.SIZE + Piece.SIZE * col, Piece.SIZE * numOfRows - 5)
         );
    }
    // create horizontal lines
    for (int row = 0; row < numOfRows - 1; row++) {
         grid.getElements().addAll(
             new MoveTo(5, Piece.SIZE + Piece.SIZE * row),
             new LineTo(Piece.SIZE * numOfColumns - 5, Piece.SIZE + Piece.SIZE * row)
         );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:PuzzlePieces.java

示例13: init

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 400,260));
    Rectangle rect = new Rectangle (0, 0, 40, 40);
    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);
    Path path = PathBuilder.create()
            .elements(
                new MoveTo(20,20),
                new CubicCurveTo(380, 0, 380, 120, 200, 120),
                new CubicCurveTo(0, 120, 0, 240, 380, 240)
            )
            .build();
    path.setStroke(Color.DODGERBLUE);
    path.getStrokeDashArray().setAll(5d,5d);
    root.getChildren().add(path);
    
    pathTransition = PathTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .path(path)
            .node(rect)
            .orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:TransitionPath.java

示例14: createSegment

import javafx.scene.shape.Path; //导入方法依赖的package包/类
private Path createSegment(final double START_ANGLE, final double END_ANGLE, final double INNER_RADIUS, final double OUTER_RADIUS, final Color FILL, final Color STROKE, final TreeNode NODE) {
    double  startAngleRad = Math.toRadians(START_ANGLE + 90);
    double  endAngleRad   = Math.toRadians(END_ANGLE + 90);
    boolean largeAngle    = Math.abs(END_ANGLE - START_ANGLE) > 180.0;

    double x1 = centerX + INNER_RADIUS * Math.sin(startAngleRad);
    double y1 = centerY - INNER_RADIUS * Math.cos(startAngleRad);

    double x2 = centerX + OUTER_RADIUS * Math.sin(startAngleRad);
    double y2 = centerY - OUTER_RADIUS * Math.cos(startAngleRad);

    double x3 = centerX + OUTER_RADIUS * Math.sin(endAngleRad);
    double y3 = centerY - OUTER_RADIUS * Math.cos(endAngleRad);

    double x4 = centerX + INNER_RADIUS * Math.sin(endAngleRad);
    double y4 = centerY - INNER_RADIUS * Math.cos(endAngleRad);

    MoveTo moveTo1 = new MoveTo(x1, y1);
    LineTo lineTo2 = new LineTo(x2, y2);
    ArcTo  arcTo3  = new ArcTo(OUTER_RADIUS, OUTER_RADIUS, 0, x3, y3, largeAngle, true);
    LineTo lineTo4 = new LineTo(x4, y4);
    ArcTo  arcTo1  = new ArcTo(INNER_RADIUS, INNER_RADIUS, 0, x1, y1, largeAngle, false);

    Path path = new Path(moveTo1, lineTo2, arcTo3, lineTo4, arcTo1);

    path.setFill(FILL);
    path.setStroke(STROKE);

    String tooltipText = new StringBuilder(NODE.getData().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getData().getValue())).toString();
    Tooltip.install(path, new Tooltip(tooltipText));

    path.setOnMousePressed(new WeakEventHandler<>(e -> NODE.getTreeRoot().fireTreeNodeEvent(new TreeNodeEvent(NODE, EventType.NODE_SELECTED))));

    return path;
}
 
开发者ID:HanSolo,项目名称:SunburstChart,代码行数:36,代码来源:SunburstChart.java

示例15: 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


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