當前位置: 首頁>>代碼示例>>Java>>正文


Java Line.setFill方法代碼示例

本文整理匯總了Java中javafx.scene.shape.Line.setFill方法的典型用法代碼示例。如果您正苦於以下問題:Java Line.setFill方法的具體用法?Java Line.setFill怎麽用?Java Line.setFill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.shape.Line的用法示例。


在下文中一共展示了Line.setFill方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LineSample

import javafx.scene.shape.Line; //導入方法依賴的package包/類
public LineSample() {
    super(180,90);
    // Create line shape
    Line line = new Line(5, 85, 175 , 5);
    line.setFill(null);
    line.setStroke(Color.RED);
    line.setStrokeWidth(2);

    // show the line shape;
    getChildren().add(line);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Line Stroke", line.strokeProperty()),
            new SimplePropertySheet.PropDesc("Line Start X", line.startXProperty(), 0d, 170d),
            new SimplePropertySheet.PropDesc("Line Start Y", line.startYProperty(), 0d, 90d),
            new SimplePropertySheet.PropDesc("Line End X", line.endXProperty(), 10d, 180d),
            new SimplePropertySheet.PropDesc("Line End Y", line.endYProperty(), 0d, 90d)
    );
    // END REMOVE ME
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:LineSample.java

示例2: Arrow

import javafx.scene.shape.Line; //導入方法依賴的package包/類
public Arrow(Double fromX, Double fromY, Double toX, Double toY, Double radius) {
	line = new Line();
	line.setStartX(fromX);
	line.setStartY(fromY);
	line.setEndX(toX);
	line.setEndY(toY);
	line.setStrokeWidth(3);
	line.setFill(Color.BLACK);
	
	this.radius = radius;
	
	indicator = createIndicator(toX, toY, radius);
	indicator.setFill(Color.BLACK);
	
	// calcolo il punto esatto in cui deve terminare la linea -- al centro del cerchio
	this.calculateActualEnd();
	
	this.getChildren().addAll(line, indicator);
}
 
開發者ID:steppp,項目名稱:Breadth-First-Search,代碼行數:20,代碼來源:Arrow.java

示例3: createIconContent

import javafx.scene.shape.Line; //導入方法依賴的package包/類
public static Node createIconContent() {
    Line line = new Line(0, 0, 70, 70);
    line.setStroke(Color.web("#b9c0c5"));
    line.setStrokeWidth(5);
    line.getStrokeDashArray().addAll(15d,15d);
    line.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));
    line.setEffect(effect);
    return line;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:LineSample.java

示例4: drawingArrowhead

import javafx.scene.shape.Line; //導入方法依賴的package包/類
protected void drawingArrowhead(double x1, double y1, double x2, double y2, Pane pane){

        Line line = new Line(x1, y1, x2, y2);
        line.setStrokeWidth(3);//設置線的寬度
        line.setFill(Color.RED);
        line.setStroke(Color.RED);
        pane.getChildren().add(line);

        // 斜率
        double slope = ((((double) y1) - (double) y2)) / (((double) x1) - (((double) x2)));

        double arctan = Math.atan(slope);

        // This will flip the arrow 45 off of a
        // perpendicular line at pt x2
        double set45 = 1.57 / 2;

        // 箭頭永遠指向i 而不是 i+1
        if (x1 < x2) {
            // add 90 degrees to arrow lines
            set45 = -1.57 * 1.5;
        }

        // set length of arrows
        int arrlen = 15;

        Line line1 = new Line(x2, y2, (x2 + (Math.cos(arctan + set45) * arrlen)), ((y2)) + (Math.sin(arctan + set45) * arrlen));
        Line line2 = new Line(x2, y2, (x2 + (Math.cos(arctan - set45) * arrlen)), ((y2)) + (Math.sin(arctan - set45) * arrlen));


        line1.setStrokeWidth(3);//設置線的寬度
        line1.setStrokeWidth(3);//設置線的寬度
        line1.setStroke(Color.RED);//顏色
        line2.setStroke(Color.RED);
        // 在線上加箭頭
        pane.getChildren().add(line1);
        pane.getChildren().add(line2);
    }
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:39,代碼來源:DrawWeighedGraph.java

示例5: drawingArrowhead

import javafx.scene.shape.Line; //導入方法依賴的package包/類
protected void drawingArrowhead(double x1, double y1, double x2, double y2, Pane pane){

        Line line = new Line(x1, y1, x2, y2);
        line.setStrokeWidth(3);//設置線的寬度
        line.setFill(Color.RED);
        line.setStroke(Color.RED);
        pane.getChildren().add(line);

        // 斜率
        double slope = (y1 -  y2) / (x1 -  x2);

        double arctan = Math.atan(slope);

        // This will flip the arrow 45 off of a
        // perpendicular line at pt x2
        double set45 = 1.57 / 2;

        // 箭頭永遠指向i 而不是 i+1
        if (x1 < x2) {
            // add 90 degrees to arrow lines
            set45 = -1.57 * 1.5;
        }

        // set length of arrows
        int arrlen = 15;

        Line line1 = new Line(x2, y2, (x2 + (Math.cos(arctan + set45) * arrlen)), ((y2)) + (Math.sin(arctan + set45) * arrlen));
        Line line2 = new Line(x2, y2, (x2 + (Math.cos(arctan - set45) * arrlen)), ((y2)) + (Math.sin(arctan - set45) * arrlen));


        line1.setStrokeWidth(3);//設置線的寬度
        line2.setStrokeWidth(3);//設置線的寬度
        line1.setStroke(Color.RED);
        line2.setStroke(Color.RED);
        // 在線上加箭頭
        pane.getChildren().add(line1);
        pane.getChildren().add(line2);
    }
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:39,代碼來源:DrawUnweighedtGraph.java

示例6: start

import javafx.scene.shape.Line; //導入方法依賴的package包/類
@Override
    public void start(Stage primaryStage) throws Exception {
        AnchorPane ap = new AnchorPane();
        final Scene scene = new Scene(ap, 600, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
        
        Line l = new Line();
        l.setFill(Color.AQUAMARINE);
//        l.setLayoutX(300);
//        l.setLayoutY(300);
        l.setStartX(300);
        l.setStartY(300);
        l.setEndX(300);
        l.setEndY(100);
        ap.getChildren().add(l);
        System.out.println("1: " + l.toString() + " tx=" + l.getTranslateX() + ", ty="+l.getTranslateY());
        
//        l.setRotate(45);
//        System.out.println("2: " + l.toString() + " tx=" + l.getTranslateX() + ", ty="+l.getTranslateY());
        // 300, 200
//        l.getTransforms().add(new Rotate(72, 300, 300));
        l.getTransforms().add(new Rotate(144, 300, 300));
//        l.getTransforms().add(new Rotate(216, 300, 300));
//        l.getTransforms().add(new Rotate(288, 300, 300));
        System.out.println("3: " + l.toString() + " tx=" + l.getBoundsInParent().toString() + ", ty="+l.getTranslateY());
        
        /*
            1=centerx,                      centery - 200
            2=centerx + 192.47137451171875, centery - 64.0634765625
            3=centerx + 119.953857421875,   centery + 164.2001953125
            4=centerx - 119.953857421875,   centery + 164.2001953125
            5=centerx - 192.47137451171875, centery - 64.0634765625
        */
    }
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:36,代碼來源:LineRotationForEndPoints.java

示例7: before

import javafx.scene.shape.Line; //導入方法依賴的package包/類
@Before
public void before()
{
	line = new Line(0d, 0d, 100d, 100d);
	line.setStroke(Color.RED);
	line.setFill(Color.RED);
	text = new Text();
	text.setStroke(Color.RED);
	text.setFill(Color.RED);

}
 
開發者ID:GeePawHill,項目名稱:contentment,代碼行數:12,代碼來源:ColorChangerTest.java

示例8: initGraphics

import javafx.scene.shape.Line; //導入方法依賴的package包/類
@Override protected void initGraphics() {
    super.initGraphics();

    if (tile.isAutoScale()) tile.calcAutoScale();
    minValue             = tile.getMinValue();
    range                = tile.getRange();
    angleStep            = ANGLE_RANGE / range;
    sectionsVisible      = tile.getSectionsVisible();
    sections             = tile.getSections();
    formatString         = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString();
    locale               = tile.getLocale();
    currentValueListener = o -> setBar(tile.getCurrentValue());

    graphicListener      = (o, ov, nv) -> { if (nv != null) { graphicContainer.getChildren().setAll(tile.getGraphic()); }};

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    enableNode(titleText, !tile.getTitle().isEmpty());

    text = new Text(tile.getText());
    text.setFill(tile.getTextColor());
    enableNode(text, tile.isTextVisible());

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.468, PREFERRED_HEIGHT * 0.468, 90, 360);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(tile.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.468, PREFERRED_HEIGHT * 0.468, 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(tile.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

    separator = new Line(PREFERRED_WIDTH * 0.5, 1, PREFERRED_WIDTH * 0.5, 0.16667 * PREFERRED_HEIGHT);
    separator.setStroke(tile.getBackgroundColor());
    separator.setFill(Color.TRANSPARENT);

    percentageValueText = new Text(String.format(locale, formatString, tile.getCurrentValue()));
    percentageValueText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    percentageValueText.setFill(tile.getValueColor());
    percentageValueText.setTextOrigin(VPos.CENTER);

    percentageUnitText = new Text(tile.getUnit());
    percentageUnitText = new Text("\u0025");
    percentageUnitText.setFont(Fonts.latoLight(PREFERRED_WIDTH * 0.08));
    percentageUnitText.setFill(tile.getUnitColor());

    percentageFlow = new TextFlow(percentageValueText, percentageUnitText);
    percentageFlow.setTextAlignment(TextAlignment.CENTER);

    valueText = new Text(String.format(locale, formatString, tile.getCurrentValue()));
    valueText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    valueText.setFill(tile.getValueColor());
    valueText.setTextOrigin(VPos.CENTER);
    enableNode(valueText, tile.isValueVisible());

    unitText = new Text(tile.getUnit());
    unitText = new Text("\u0025");
    unitText.setFont(Fonts.latoLight(PREFERRED_WIDTH * 0.08));
    unitText.setFill(tile.getUnitColor());
    enableNode(unitText, !tile.getUnit().isEmpty());

    valueUnitFlow = new TextFlow(valueText, unitText);
    valueUnitFlow.setTextAlignment(TextAlignment.CENTER);

    graphicContainer = new StackPane();
    graphicContainer.setMinSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    graphicContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    graphicContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    if (null == tile.getGraphic()) {
        enableNode(graphicContainer, false);
    } else {
        graphicContainer.getChildren().setAll(tile.getGraphic());
    }

    getPane().getChildren().addAll(barBackground, bar, separator, titleText, text, graphicContainer, percentageFlow, valueUnitFlow);
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:82,代碼來源:CircularProgressTileSkin.java

示例9: initGraphics

import javafx.scene.shape.Line; //導入方法依賴的package包/類
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    colorRing = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.5);
    colorRing.setFill(Color.TRANSPARENT);
    colorRing.setStrokeWidth(PREFERRED_WIDTH * 0.0075);
    colorRing.setStroke(gauge.getBarColor());

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.468, PREFERRED_HEIGHT * 0.468, 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.15);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

    separator = new Line(PREFERRED_WIDTH * 0.5, 1, PREFERRED_WIDTH * 0.5, 0.16667 * PREFERRED_HEIGHT);
    separator.setStroke(gauge.getBorderPaint());
    separator.setFill(Color.TRANSPARENT);

    titleText = new Text(gauge.getTitle());
    titleText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08));
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFont(Fonts.robotoRegular(PREFERRED_WIDTH * 0.27333));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText = new Text(gauge.getUnit());
    unitText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08));
    unitText.setFill(gauge.getUnitColor());
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    pane = new Pane(colorRing, bar, separator, titleText, valueText, unitText);
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:49,代碼來源:FlatSkin.java

示例10: draw

import javafx.scene.shape.Line; //導入方法依賴的package包/類
private void draw(String png, int placing, List<IVRPSimulationModelStructureElement> elements, boolean dummy, ITime simulationTimeOfLastEventOccurence) {
		double x = (Math.cos(placing * angle) * (radius - delta)) + radius;
		double y = (Math.sin(placing * angle) * (radius - delta)) + radius;

		Circle circle = new Circle(10);
		circle.setFill(Color.TRANSPARENT);

		if (!dummy) {
			Line line = new Line(radius, radius, x, y);
			line.setSmooth(true);
			line.setStroke(lineColor);
			line.setFill(lineColor);
			this.getChildren().add(line);

			circle.setOnMouseEntered(event -> {
				circle.setStroke(circleColorHighlighted);
			});
			circle.setOnMouseExited(event -> {
				circle.setStroke(Color.TRANSPARENT);
			});

			circle.setOnMousePressed((EventHandler<? super MouseEvent>) event -> {
				try {
					popup.update(elements, simulationTimeOfLastEventOccurence);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				if (!popup.isShowing()) {
//					popup.hide();
					popup.setAutoFix(true);
					popup.show(this, event.getScreenX(), event.getScreenY());
				}
				event.consume();
			});

			circle.setFill(new ImagePattern(new Image(png)));
		}
		circle.setSmooth(true);
		circle.setCenterX(x);
		circle.setCenterY(y);
		circle.setStroke(Color.TRANSPARENT);
		this.getChildren().add(circle);
	}
 
開發者ID:MayerTh,項目名稱:RVRPSimulator,代碼行數:46,代碼來源:NetworkNodeVisualization.java

示例11: createConnection

import javafx.scene.shape.Line; //導入方法依賴的package包/類
private void createConnection(PairingNode previousNode,
        Player previousPlayer, PairingNode nextNode, List<Node> nodes) {

    Line horizontal1 = new Line();
    horizontal1.setFill(Color.TRANSPARENT);
    horizontal1.setStroke(Color.BLACK);
    horizontal1.setStrokeWidth(2);
    Line vertical = new Line();
    vertical.setFill(Color.TRANSPARENT);
    vertical.setStroke(Color.BLACK);
    vertical.setStrokeWidth(2);
    Line horizontal2 = new Line();
    horizontal2.setFill(Color.TRANSPARENT);
    horizontal2.setStroke(Color.BLACK);
    horizontal2.setStrokeWidth(2);

    NumberExpression left = new DoubleBinding() {
        {
            super.bind(previousNode.layoutXProperty(),
                    previousNode.widthProperty());
        }

        @Override
        protected double computeValue() {
            return previousNode.getLayoutX() + previousNode.getWidth();
        }
    };
    NumberExpression top = new DoubleBinding() {
        {
            super.bind(previousNode.layoutYProperty(),
                    previousNode.heightProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(previousNode.getLayoutY()
                    + previousNode.getHeight() / 2d);
        }
    };
    NumberExpression bottom = new DoubleBinding() {
        {
            super.bind(nextNode.layoutYProperty(),
                    nextNode.heightProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(nextNode.getLayoutY() + nextNode.getHeight()
                    / 2d);
        }
    };
    NumberExpression center = new DoubleBinding() {
        {
            super.bind(nextNode.layoutXProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(nextNode.getLayoutX() - 25);
        }
    };

    horizontal1.startXProperty().bind(left);
    horizontal1.endXProperty().bind(center);
    horizontal1.startYProperty().bind(top);
    horizontal1.endYProperty().bind(top);

    vertical.startXProperty().bind(center);
    vertical.endXProperty().bind(center);
    vertical.startYProperty().bind(top);
    vertical.endYProperty().bind(bottom);

    horizontal2.startXProperty().bind(center);
    horizontal2.endXProperty().bind(nextNode.layoutXProperty());
    horizontal2.startYProperty().bind(bottom);
    horizontal2.endYProperty().bind(bottom);

    nodes.add(horizontal1);
    nodes.add(vertical);
    nodes.add(horizontal2);
}
 
開發者ID:Novanoid,項目名稱:Tourney,代碼行數:82,代碼來源:PairingView.java


注:本文中的javafx.scene.shape.Line.setFill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。