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


Java Shape.setStroke方法代码示例

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


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

示例1: strokeFrom

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
 * Animates the element's border 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 strokeFrom(double duration, Color color) {

    KeyValue keyValueX;

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

        shape.setStroke(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: addDebugView

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void addDebugView(HitBox hitBox) {
    Shape view = null;

    if (hitBox.getShape().isCircle()) {
        double radius = hitBox.getWidth() / 2;
        view = new Circle(radius, radius, radius, null);

    } else if (hitBox.getShape().isRectangle()) {
        view = new Rectangle(hitBox.getWidth(), hitBox.getHeight(), null);
    }

    if (view != null) {
        view.setStroke(showBBoxColor);

        view.setTranslateX(hitBox.getMinX());
        view.setTranslateY(hitBox.getMinY());

        debugBBox.getChildren().add(view);
    }
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:21,代码来源:ViewComponent.java

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

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

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override
public boolean accept(Node node)
{
	if (node instanceof Shape)
	{
		Shape shape = (Shape) node;
		if (result == null) result = shape.getStroke();
		shape.setStroke(paint);
	}
	if (node instanceof Text)
	{
		Text text = (Text) node;
		text.setFill(paint);
	}
	return true;
}
 
开发者ID:GeePawHill,项目名称:contentment,代码行数:17,代码来源:ColorChanger.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: 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

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

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

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

示例13: applyStyle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void applyStyle(Shape shape) {
    shape.setMouseTransparent(true);
    shape.setSmooth(false);
    shape.setStrokeWidth(1.0);
    shape.setVisible(false);
    shape.setStrokeType(StrokeType.CENTERED);
    shape.setStroke(Color.STEELBLUE);
    Color fillColor = Color.LIGHTSTEELBLUE;
    shape.setFill(new Color(
            fillColor.getRed(),
            fillColor.getGreen(),
            fillColor.getBlue(),
            SELECTION_OPACITY));
}
 
开发者ID:fthevenet,项目名称:binjr,代码行数:15,代码来源:XYChartCrosshair.java

示例14: decorateShape

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void decorateShape(Shape s, Color fill, Color stroke, double opacity) {
    s.setMouseTransparent(true);
    s.setFill(fill);
    s.setStroke(stroke);
    s.setOpacity(opacity);
}
 
开发者ID:dejv78,项目名称:jfx.radialmenu,代码行数:7,代码来源:RadialDebug.java


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