當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。