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


Java Polygon.toBack方法代码示例

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


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

示例1: drawDiamond

import javafx.scene.shape.Polygon; //导入方法依赖的package包/类
private Group drawDiamond(double startX, double startY, double endX, double endY){
    Group group = new Group();
    double phi = Math.toRadians(40);
    int barb = 14;
    double dy = startY - endY;
    double dx = startX - endX;
    double theta = Math.atan2(dy, dx);
    double x, y, rho = theta + phi;

    double[] xs = new double[2];
    double[] ys = new double[2];
    double x4, y4;
    x4 = startX - 23*Math.cos(theta);
    y4 = startY - 23*Math.sin(theta);
    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        xs[j] = x;
        ys[j] = y;
        rho = theta - phi;
    }

    Polygon background = new Polygon();
    background.getPoints().setAll(startX, startY,
            xs[0], ys[0],
            x4, y4,
            xs[1], ys[1]);
    background.setFill(Color.WHITE);
    background.toBack();
    Line line1 = new Line(startX, startY, xs[0], ys[0]);
    Line line2 = new Line(startX, startY, xs[1], ys[1]);
    Line line3 = new Line(xs[0], ys[0], x4, y4);
    Line line4 = new Line(xs[1], ys[1], x4, y4);
    line1.setStrokeWidth(super.STROKE_WIDTH);
    line2.setStrokeWidth(super.STROKE_WIDTH);
    line3.setStrokeWidth(super.STROKE_WIDTH);
    line4.setStrokeWidth(super.STROKE_WIDTH);
    group.getChildren().add(background);
    group.getChildren().add(line1);
    group.getChildren().add(line2);
    group.getChildren().add(line3);
    group.getChildren().add(line4);
    diamondLines.addAll(Arrays.asList(line1, line2, line3, line4));
    if(super.isSelected()){
        for(Line l : diamondLines){
            l.setStroke(Constants.selected_color);
        }
    }
    return group;
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:51,代码来源:AggregationEdgeView.java

示例2: drawArrowHead

import javafx.scene.shape.Polygon; //导入方法依赖的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;

    double[] xs = new double[2];
    double[] ys = new double[2];

    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        xs[j] = x;
        ys[j] = y;
        rho = theta - phi;
    }

    Polygon background = new Polygon();
    background.getPoints().addAll(startX, startY,
            xs[0], ys[0],
            xs[1], ys[1]);
    background.setFill(Color.WHITE);
    background.toBack();
    Line line1 = new Line(startX, startY, xs[0], ys[0]);
    Line line2 = new Line(startX, startY, xs[1], ys[1]);
    Line line3 = new Line(xs[0], ys[0], xs[1], ys[1]);
    line1.setStrokeWidth(super.STROKE_WIDTH);
    line2.setStrokeWidth(super.STROKE_WIDTH);
    line3.setStrokeWidth(super.STROKE_WIDTH);
    group.getChildren().add(background);
    group.getChildren().add(line1);
    group.getChildren().add(line2);
    group.getChildren().add(line3);
    arrowHeadLines.addAll(Arrays.asList(line1, line2, line3));
    if(super.isSelected()){
        for(Line l : arrowHeadLines){
            l.setStroke(Constants.selected_color);
        }
    }
    return group;
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:55,代码来源:InheritanceEdgeView.java

示例3: drawDiamond

import javafx.scene.shape.Polygon; //导入方法依赖的package包/类
private Group drawDiamond(double startX, double startY, double endX, double endY){
    Group group = new Group();
    double phi = Math.toRadians(40);
    int barb = 14;
    double dy = startY - endY;
    double dx = startX - endX;
    double theta = Math.atan2(dy, dx);
    double x, y, rho = theta + phi;

    double[] xs = new double[2];
    double[] ys = new double[2];
    double x4, y4;
    x4 = startX - 23*Math.cos(theta);
    y4 = startY - 23*Math.sin(theta);
    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        xs[j] = x;
        ys[j] = y;
        rho = theta - phi;
    }
    diamondBackground = new Polygon();
    diamondBackground.getPoints().setAll(startX, startY,
            xs[0], ys[0],
            x4, y4,
            xs[1], ys[1]);
    if(super.isSelected()){
        diamondBackground.setFill(Constants.selected_color);
    } else {
        diamondBackground.setFill(Color.BLACK);
    }
    diamondBackground.toBack();
    Line line1 = new Line(startX, startY, xs[0], ys[0]);
    Line line2 = new Line(startX, startY, xs[1], ys[1]);
    Line line3 = new Line(xs[0], ys[0], x4, y4);
    Line line4 = new Line(xs[1], ys[1], x4, y4);
    line1.setStrokeWidth(super.STROKE_WIDTH);
    line2.setStrokeWidth(super.STROKE_WIDTH);
    line3.setStrokeWidth(super.STROKE_WIDTH);
    line4.setStrokeWidth(super.STROKE_WIDTH);
    group.getChildren().add(diamondBackground);
    group.getChildren().add(line1);
    group.getChildren().add(line2);
    group.getChildren().add(line3);
    group.getChildren().add(line4);
    diamondLines.addAll(Arrays.asList(line1, line2, line3, line4));
    if(super.isSelected()){
        for(Line l : diamondLines){
            l.setStroke(Constants.selected_color);
        }
    }
    return group;
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:54,代码来源:CompositionEdgeView.java

示例4: drawArrowHead

import javafx.scene.shape.Polygon; //导入方法依赖的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;

    double[] xs = new double[2];
    double[] ys = new double[2];

    for (int j = 0; j < 2; j++) {
        x = startX - barb * Math.cos(rho);
        y = startY - barb * Math.sin(rho);
        xs[j] = x;
        ys[j] = y;
        rho = theta - phi;
    }

    Polygon background = new Polygon();
    background.getPoints().addAll(startX, startY, xs[0], ys[0], xs[1], ys[1]);
    background.setFill(Color.WHITE);
    background.toBack();
    Line line1 = new Line(startX, startY, xs[0], ys[0]);
    Line line2 = new Line(startX, startY, xs[1], ys[1]);
    Line line3 = new Line(xs[0], ys[0], xs[1], ys[1]);
    line1.setStrokeWidth(super.STROKE_WIDTH);
    line2.setStrokeWidth(super.STROKE_WIDTH);
    line3.setStrokeWidth(super.STROKE_WIDTH);
    group.getChildren().add(background);
    group.getChildren().add(line1);
    group.getChildren().add(line2);
    group.getChildren().add(line3);
    arrowHeadLines.addAll(Arrays.asList(line1, line2, line3));
    if(super.isSelected()){
        for(Line l : arrowHeadLines){
            l.setStroke(Constants.selected_color);
        }
    }
    return group;
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:53,代码来源:RealizationEdgeView.java


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