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


Java Line.setStroke方法代码示例

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


在下文中一共展示了Line.setStroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createIconContent

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");
            
    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:StringBindingSample.java

示例3: setSelected

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void setSelected(boolean selected){
    super.setSelected(selected);
    Color color;
    if(selected){
        color = Constants.selected_color;
    } else {
        color = Color.BLACK;
    }

    for(Line l : arrowHeadLines){
        l.setStroke(color);
    }
    title.setFill(color);
    if(circleHandle != null){
        circleHandle.setFill(color);
    }
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:18,代码来源:MessageEdgeView.java

示例4: drawArrowHead

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Draws an ArrowHead and returns it in a group.
 * Based on code from http://www.coderanch.com/t/340443/GUI/java/Draw-arrow-head-line
 * @param startX
 * @param startY
 * @param endX
 * @param endY
 * @return Group.
 */
private void drawArrowHead(double startX, double startY, double endX, double endY) {
    arrowHead.getChildren().clear();
    double phi = Math.toRadians(30);
    int barb = 15;
    double dy = startY - endY;
    double dx = startX - endX;
    double theta = Math.atan2(dy, dx);
    double x, y, rho = theta + phi;

    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        Line arrowHeadLine = new Line(startX, startY, x, y);
        arrowHeadLine.setStrokeWidth(super.STROKE_WIDTH);
        arrowHeadLines.add(arrowHeadLine);
        if(super.isSelected()){
            arrowHeadLine.setStroke(Constants.selected_color);
        }
        arrowHead.getChildren().add(arrowHeadLine);
        rho = theta - phi;
    }
}
 
开发者ID:Imarcus,项目名称:OctoUML,代码行数:32,代码来源:MessageEdgeView.java

示例5: drawArrowHead

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Draws an ArrowHead and returns it in a group.
 * Based on code from http://www.coderanch.com/t/340443/GUI/java/Draw-arrow-head-line
 * @param startX
 * @param startY
 * @param endX
 * @param endY
 * @return Group.
 */
private Group drawArrowHead(double startX, double startY, double endX, double endY) {
    Group group = new Group();
    double phi = Math.toRadians(40);
    int barb = 20;
    double dy = startY - endY;
    double dx = startX - endX;
    double theta = Math.atan2(dy, dx);
    double x, y, rho = theta + phi;

    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        Line arrowHeadLine = new Line(startX, startY, x, y);
        arrowHeadLine.setStrokeWidth(super.STROKE_WIDTH);
        arrowHeadLines.add(arrowHeadLine);
        if(super.isSelected()){
            arrowHeadLine.setStroke(Constants.selected_color);
        }
        group.getChildren().add(arrowHeadLine);
        rho = theta - phi;
    }
    return group;
}
 
开发者ID:Imarcus,项目名称:OctoUML,代码行数:33,代码来源:AssociationEdgeView.java

示例6: playWinAnimation

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private void playWinAnimation(TileCombo combo) {
    Line line = new Line();
    line.setStartX(combo.getTile1().getCenter().getX());
    line.setStartY(combo.getTile1().getCenter().getY());
    line.setEndX(combo.getTile1().getCenter().getX());
    line.setEndY(combo.getTile1().getCenter().getY());
    line.setStroke(Color.YELLOW);
    line.setStrokeWidth(3);

    getGameScene().addUINode(line);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1),
            new KeyValue(line.endXProperty(), combo.getTile3().getCenter().getX()),
            new KeyValue(line.endYProperty(), combo.getTile3().getCenter().getY())));
    timeline.setOnFinished(e -> gameOver(combo.getWinSymbol()));
    timeline.play();
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:19,代码来源:TicTacToeApp.java

示例7: positionedLine

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Positions and styles the pen according to the information
 * from the turtle.
 * 
 * @param startx - starting X position
 * @param starty - starting Y position
 * @param endx - ending X position
 * @param endy - ending Y position
 * @param penColor - color of the stroke
 * @param penWidth - width of the stroke
 * @param penStyleIndex - style index from properties file
 * @return the positioned and styled line
 */
private Line positionedLine (double startx,
                             double starty,
                             double endx,
                             double endy,
                             Color penColor,
                             String penWidth,
                             int penStyleIndex) {

    Line line = new Line(startx, starty, endx, endy);
    line.setTranslateX(endx - (endx - startx) / 2);
    line.setTranslateY(endy - (endy - starty) / 2);
    line.setStroke(penColor);
    line.setStrokeWidth(Double.parseDouble(penWidth));
    line.getStrokeDashArray().clear();
    
    for(Double d : assignDashArray(penStyleIndex)) {
    	line.getStrokeDashArray().add(d);
    }
    
    return line;
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:35,代码来源:GraphicsWindow.java

示例8: setChildItems

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void setChildItems(String gui, String[] item) {
        // 貰った親のアイテムを全てのアイテムの中から探して,同じものが選択されたとき,下にguiを追加
        // guiを設定する時は conBox に上に線を引いた上で追加する。

        if (childFlag) {
            removeChildGUI();
        }
        childFlag = true;
        Line vborderline = new Line(0, 0, box.initBoxSizeX, 0);
        vborderline.setStroke(Color.web("#B3B3B3"));
        conBox.getChildren().add(vborderline);

        System.out.println("----------------------------- in setChildItems");
        setGUI(gui, item, "child");

//        this.setChildItem(item[0]);
//        changeBoxSize();
    }
 
开发者ID:ryohashioka,项目名称:Visual-Programming-Environment-for-Coordinating-Appliances-and-Services-in-a-Smart-House,代码行数:19,代码来源:BoxToSetUp.java

示例9: itemOnOff

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void itemOnOff() {
    if (itemFlag) {
        vbox.getChildren().remove(1);
        boxSizeY = boxSizeY - initBoxSizeY;
        setBoxSize();
        itemFlag = false;
    } else {
        Label itemlabel = new Label();
        itemlabel.setAlignment(Pos.BASELINE_CENTER);
        itemlabel.setText(itemStr);
        // 条件文とオブジェクト名の間に入れる線
        Line borderline = new Line(0, 0, initBoxSizeX, 0);
        borderline.setStroke(Color.web("#B3B3B3"));

        itemlabel.setGraphic(borderline);
        itemlabel.setContentDisplay(ContentDisplay.TOP);
        vbox.getChildren().add(1, itemlabel);
        boxSizeY = boxSizeY + initBoxSizeY;
        setBoxSize();
        itemFlag = true;
        reSetItem();
    }
}
 
开发者ID:ryohashioka,项目名称:Visual-Programming-Environment-for-Coordinating-Appliances-and-Services-in-a-Smart-House,代码行数:24,代码来源:Box.java

示例10: createSnapIndicators

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Initializes snap inidicators for AbstractNode.
 * @param n
 */
private void createSnapIndicators(AbstractNode n){
    Line xSnapIndicator = new Line(0,0,0,0);
    Line ySnapIndicator = new Line(0,0,0,0);
    xSnapIndicator.setStroke(Color.BLACK);
    ySnapIndicator.setStroke(Color.BLACK);
    aDrawPane.getChildren().addAll(xSnapIndicator, ySnapIndicator);
    xSnapIndicatorMap.put(n, xSnapIndicator);
    ySnapIndicatorMap.put(n, ySnapIndicator);
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:14,代码来源:NodeController.java

示例11: drawGrid

import javafx.scene.shape.Line; //导入方法依赖的package包/类
void drawGrid() {
    grid.clear();
    for (int i = 0; i < 8000; i += Constants.GRID_DISTANCE) {
        Line line1 = new Line(i, 0, i, 8000);
        line1.setStroke(Color.LIGHTGRAY);
        Line line2 = new Line(0, i, 8000, i);
        line2.setStroke(Color.LIGHTGRAY);
        grid.add(line1);
        grid.add(line2);
        aDrawPane.getChildren().addAll(line1, line2);
    }
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:13,代码来源:GraphController.java

示例12: start

import javafx.scene.shape.Line; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
	Group root = new Group();
	Line seeSaw = new Line (60,340,340,140);
	seeSaw.setStroke(Color.BLACK);
	seeSaw.setStrokeWidth(15);
	Circle circle = new Circle(70,280,40);
	circle.setStroke(Color.GREENYELLOW);
	circle.setFill(Color.ORANGE);
	circle.setStrokeWidth(5);
	
	Rectangle rect = new Rectangle(240,90,80,70);
	rect.setStroke(Color.MEDIUMPURPLE);
	rect.setStrokeWidth(5);
	rect.setFill(Color.MEDIUMPURPLE);
	
	Line left = new Line (200,240,160,340);
	left.setStrokeWidth(5);
	Line right = new Line(200,240,240,340);
	right.setStrokeWidth(5);
	
	root.getChildren().addAll(seeSaw,rect,circle,left,right);
	
	
	
	Scene scene = new Scene(root, 400, 400,Color.WHITE);
	primaryStage.setTitle("SeeSaw");
	primaryStage.setScene(scene);
	primaryStage.show();
	
	
	
}
 
开发者ID:naeemkhan12,项目名称:JavaFx-Material-Design,代码行数:34,代码来源:Playground.java

示例13: makeGroup

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Make group.
 */
public void makeGroup(){
    double displayNum = lineDensity;
    if (displayNum>100){
        displayNum = 100;
    }
    lines.getChildren().clear();
    for(int i=1; i<=displayNum*2; i+=2){
        Line line1 = new Line(i, 0, i, 100);
        line1.setStroke(WavelengthToColor.getColor(mmWavelength,1));
        lines.getChildren().add(line1);
    }

}
 
开发者ID:RudyB,项目名称:Optics-Simulator,代码行数:17,代码来源:GratingApertureDrawing.java

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

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


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