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


Java Shape.setFill方法代码示例

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


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

示例1: fillFrom

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
 * Animates the element's color from the given rotation to the existing one. CAN ONLY BE APPLIED TO SHAPES.
 * @param duration Duration of the animation
 * @param color The color to animate from
 */
public Sprint fillFrom(double duration, Color color) {

    KeyValue keyValueX;

    if (node instanceof Shape) {
        Shape shape = (Shape) node;
        keyValueX = new KeyValue(shape.fillProperty(), shape.getFill(), interpolator);

        shape.setFill(color);
    } else {
        return this;
    }

    KeyFrame keyFrame = new KeyFrame(Duration.seconds(duration), keyValueX);
    timeline.getKeyFrames().add(keyFrame);

    return this;
}
 
开发者ID:kirankunigiri,项目名称:Sprint-JavaFX-Animation,代码行数:24,代码来源:Sprint.java

示例2: start

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
    double r = SMALL ? 100 : 1843200.0;
    double c = D - r / sqrt2;

    Circle circle = new Circle(c, c, r, Color.GREY);
    Circle littlecircle = new Circle(c, c, 10, Color.GREY);
    Shape shape = Shape.union(circle, littlecircle);
    printShape(shape);

    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, SIZE, SIZE));
    stage.show();
}
 
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:22,代码来源:ShapeOutlineBugCirclePath.java

示例3: TestLoadingScene

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public TestLoadingScene() {

        getText().setFont(Font.font("Segoe UI", 24));
        getText().setTranslateY(50);

        Circle circle = new Circle(50, 50, 50);

        Shape shape = Shape.subtract(new Rectangle(100, 100), circle);
        shape.setFill(Color.BLUE);
        shape.setStroke(Color.YELLOW);

        RotateTransition rt = new RotateTransition(Duration.seconds(2), shape);
        rt.setByAngle(360);
        rt.setCycleCount(15);
        rt.play();

        shape.setTranslateX(700);
        shape.setTranslateY(500);

        getContentRoot().getChildren().set(1, shape);
    }
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:22,代码来源:TestLoadingScene.java

示例4: setHighlight0

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
 * Create or destroy the highlight node as necessary.
 * */
private void setHighlight0(final CameraAngle angle) {
	final ObservableList<Node> graph = subGraph.getChildren();

	if (highlightColor.isPresent()) {
		final Shape n = highlightNode.orElseGet(() -> {
			final Shape r = getHighlightShape(angle);
			r.setCache(true);

			// the highlighter goes in the second to last position, so that it
			// always appears behind the debug text
			graph.add(graph.size() - 1, r);
			highlightNode = Optional.of(r);
			return r;
		});

		n.setFill(highlightColor.get());
	} else {
		highlightNode.ifPresent(n -> {
			graph.remove(n);
			highlightNode = Optional.empty();
		});
	}
}
 
开发者ID:CLowcay,项目名称:iso-game-engine,代码行数:27,代码来源:Tile.java

示例5: PaneThumbnail

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public Pane PaneThumbnail()
{
	Pane p = new Pane();
	p.setMinHeight(30);
	p.setMinWidth(30);

	for (Shape thumb : Thumbnail())
	{
		thumb.setStroke(Color.BLACK);
		if (thumb.getStrokeWidth() == 1.0) thumb.setStrokeWidth(0);
		if (thumb.fillProperty().get() == null) thumb.setFill(Color.BLACK);
		p.getChildren().add(thumb);
	}
	
	return p;
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:17,代码来源:Overlay.java

示例6: Draw

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double outerDiamX = canvas.getWidth() * (GetDoubleAttribute("Width") / MaximumX);
	double outerDiamY = GetDoubleAttribute("Height") == 0
		? outerDiamX
		: canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY);

	double proportion = GetDoubleAttribute("Size") / MaximumX;
	double innerDiamX = outerDiamX * proportion;
	double innerDiamY = outerDiamY * proportion;

	double locX = (canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX));
	double locY = (canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY));

	Ellipse outer = new Ellipse(locX, locY, outerDiamX / 2, outerDiamY / 2);
	Ellipse inner = new Ellipse(locX, locY, innerDiamX / 2, innerDiamY / 2);
	Shape ring = Path.subtract(outer, inner);
	ring.setFill(GetColorAttribute("Color"));
	canvas.getChildren().add(ring);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:22,代码来源:OverlayRing.java

示例7: frame

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style frame(Paint stroke, Paint fill, Double width, Double opacity, Dash dash)
{
	StyleApplier applier = new StyleApplier()
	{
		@Override
		public void apply(Shape shape)
		{
			shape.setStroke(stroke);
			shape.setFill(fill);
			shape.setStrokeWidth(width);
			shape.setOpacity(opacity);
			shape.getStrokeDashArray().clear();
			shape.getStrokeDashArray().addAll(dash.array);
		}
	};
	String value = "Frame: " + stroke.toString() + " Fill: " + fill.toString() + " Width: " + width + " Opacity: " + opacity
			+ " Dash: " + dash;
	return new Style(KEY, applier, value);

}
 
开发者ID:GeePawHill,项目名称:contentment,代码行数:21,代码来源:Frames.java

示例8: color

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style color(Paint stroke, Paint fill, Double opacity)
{
	StyleApplier applier = new StyleApplier()
	{
		@Override
		public void apply(Shape shape)
		{
			shape.setStroke(stroke);
			shape.setFill(fill);
			shape.setOpacity(opacity);
		}
	};
	String value = "Stroke: " + stroke.toString() + " Fill: " + fill.toString() + " Opacity: " + opacity;
	return new Style(COLOR, applier, value);

}
 
开发者ID:GeePawHill,项目名称:contentment,代码行数:17,代码来源:TypeFace.java

示例9: LoadingCircle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public LoadingCircle() {
    Circle circle = new Circle(20);
    circle.setFill(null);
    circle.setStroke(Color.WHITE);
    circle.setStrokeWidth(2);

    Rectangle rect = new Rectangle(20, 20);

    Shape shape = Shape.subtract(circle, rect);
    shape.setFill(Color.WHITE);

    getChildren().add(shape);

    animation = new RotateTransition(Duration.seconds(2.5), this);
    animation.setByAngle(-360);
    animation.setInterpolator(Interpolator.LINEAR);
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:20,代码来源:FarCry4Loading.java

示例10: TriCircle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
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));
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:18,代码来源:MKXMenuApp.java

示例11: setFillType

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
 * Sets the fill type of a shape based on this cell's type
 * @param n the shape to set the fill of
 * @param state the state of the cell, determines coloring
 */
private void setFillType(Shape n, CellState state) {
    Color baseColor = Color.web(state.getBackgroundColor());
    switch(this.type) {
        case LOCAL:
            n.setFill(baseColor);
            break;
        case REMOTE:
            n.setFill(Color.web(BACKGROUND_COLOR));
            n.setStroke(baseColor);
            break;
        case BOTH:
            n.setFill(baseColor);
            n.setStroke(baseColor);
            break;
        default:
            break;
    }
}
 
开发者ID:dmusican,项目名称:Elegit,代码行数:24,代码来源:Cell.java

示例12: applyShapeProperties

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
protected void applyShapeProperties(Shape p)
{
	p.setFill(fill);
	p.setStroke(strokeColor);
	p.setStrokeDashOffset(dashOffset);
	p.setStrokeLineCap(lineCap);
	p.setStrokeLineJoin(lineJoin);
	p.setStrokeMiterLimit(miterLimit);
	p.setStrokeType(strokeType);
	p.setStrokeWidth(strokeWidth);
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:12,代码来源:FxIconBuilder.java

示例13: setup

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
protected TestNode setup()
{
    final TestNode root = new TestNode();
    PageWithSlots page;
    image = new Image(getClass().getResourceAsStream("/test/scenegraph/resources/square.png"));

    for(Shapes shape: Shapes.values())
    {
        page = new PageWithSlots(shape.toString(), 800, 600);
        page.setSlotSize(200, 200);
        root.add(page);
        Shape sh;

        for(TransformCommand tc: TransformCommand.values())
        {
            sh = shape.getShape();
            sh.setFill(new ImagePattern(image, 0, 0, 0.5, 0.5, true));
            tc.transformShape(sh);
            ImagePatternApp.Leaf leaf = new ImagePatternApp.Leaf(tc.toString(), sh);
            leaf.setSize(200, 200);
            page.add(leaf);
        }
    }

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

示例14: configShape

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
protected void configShape(Shape p)
{
	p.setFill(fill);
	p.setStroke(strokeColor);
	p.setStrokeDashOffset(dashOffset);
	p.setStrokeLineCap(lineCap);
	p.setStrokeLineJoin(lineJoin);
	p.setStrokeMiterLimit(miterLimit);
	p.setStrokeType(strokeType);
	p.setStrokeWidth(strokeWidth);
}
 
开发者ID:andy-goryachev,项目名称:FxDock,代码行数:12,代码来源:FxIconBuilder.java

示例15: setShapeAttrs

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void setShapeAttrs(Shape shape) {
    shape.setFill(randomColors ? randomColor() : Color.BLUE);
    if (STROKE_COLOR != null) {
        shape.setStroke(STROKE_COLOR);
        shape.setStrokeType(StrokeType.INSIDE);
        shape.setStrokeWidth(0.5);
    }
}
 
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:9,代码来源:TrianglePerformanceTest.java


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