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


Java Path.setFill方法代码示例

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


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

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

    MoveTo start = new MoveTo();
    LineTo l1 = new LineTo();
    LineTo l2 = new LineTo();
    LineTo l3 = new LineTo();

    start.xProperty().bind(ax);
    start.yProperty().bind(ay);

    l1.xProperty().bind(bx);
    l1.yProperty().bind(by);

    l2.xProperty().bind(cx);
    l2.yProperty().bind(cy);

    l3.xProperty().bind(ax);
    l3.yProperty().bind(ay);

    triangle.setFill(Color.BLACK);
    triangle.getElements().addAll(start, l1, l2, l3);

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

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

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

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

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

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

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

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

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

示例12: 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 Paint 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.getItem().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getItem().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,项目名称:charts,代码行数:36,代码来源:SunburstChart.java

示例13: initGraphics

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

    state = State.CONSTANT;

    triangle = new Path();
    triangle.setStroke(null);
    triangle.setFill(state.color);
    triangle.setRotate(state.angle);

    nameText = new Text(getName());
    nameText.setTextOrigin(VPos.TOP);

    valueText = new Text(String.format(locale, formatString, getValue()));
    valueText.setTextOrigin(VPos.TOP);

    separator = new Line();

    pane = new Pane(triangle, nameText, valueText, separator);
    pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

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

示例14: makePath

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public Path makePath() {
    Path p = new Path();
    p.setFill(Color.BLACK);
    p.setStroke(null);
    p.setCache(false);
    p.setSmooth(false);
    return p;
}
 
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:9,代码来源:TestNonAARasterization.java

示例15: VFlow

import javafx.scene.shape.Path; //导入方法依赖的package包/类
public VFlow(FxEditor ed)
{
	this.editor = ed;
	
	clip = new Rectangle();
	
	selectionHighlight = new Path();
	FX.style(selectionHighlight, FxEditor.HIGHLIGHT);
	selectionHighlight.setManaged(false);
	selectionHighlight.setStroke(null);
	selectionHighlight.setFill(Color.rgb(255, 255, 0, 0.25));
	
	caretPath = new Path();
	FX.style(caretPath, FxEditor.CARET);
	caretPath.setManaged(false);
	caretPath.setStroke(Color.BLACK);
	
	caretAnimation = new Timeline();
	caretAnimation.setCycleCount(Animation.INDEFINITE);
	
	getChildren().addAll(selectionHighlight, caretPath);
	setClip(clip);
	
	caretPath.visibleProperty().bind(new BooleanBinding()
	{
		{
			bind(caretVisible, editor.displayCaret, editor.focusedProperty(), editor.disabledProperty(), suppressBlink);
		}

		protected boolean computeValue()
		{
			return (isCaretVisible() || suppressBlink.get()) && editor.isDisplayCaret() && editor.isFocused() && (!editor.isDisabled());
		}
	});
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:36,代码来源:VFlow.java


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