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


Java Shape.subtract方法代码示例

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


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

示例1: generateOutline

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
 * Once we have drawn the path, we call this method to generate two paths 
 * (outer and inner paths) and get a SVGPath with them that can be exported
 * @param drawPath The original path
 * @param svg
 * @return the content string of the SVGPath with two paths
 */
public boolean generateOutline(Path drawPath, SVGPath svg) {
    Pane pane = (Pane) drawPath.getParent();
    final double width = pane.getWidth() * WIDTH_FACTOR; 
    
    Path outterPath = new Path(drawPath.getElements());
    outterPath.setStroke(drawPath.getStroke());
    outterPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    outterPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    outterPath.setStrokeWidth(width);
    Path s1 = (Path) Shape.subtract(outterPath, new Rectangle(0, 0));

    Path innerPath = new Path(drawPath.getElements());
    innerPath.setStrokeWidth(0);
    innerPath.setStroke(drawPath.getStroke());
    innerPath.setStrokeLineJoin(drawPath.getStrokeLineJoin());
    innerPath.setStrokeLineCap(drawPath.getStrokeLineCap());
    Path s2 = (Path) Shape.subtract(innerPath, new Rectangle(0, 0));
    
    Path result = (Path) Shape.subtract(s1, s2);
    clearSmallPolygons(result);
    svg.setContent(pathsToSVGPath());
    return validPaths.size() == 2;
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:31,代码来源:BadgeOutline.java

示例2: initGraphics

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void initGraphics() {
    gradient = new ConicalGradient(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, gradientLookup.getStops());

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, center),
                          new Circle(center, center, PREFERRED_WIDTH * 0.28813559));
    ring.setFill(gradient.getImagePattern(ring.getLayoutBounds()));

    mainCircle = new Circle();
    mainCircle.setStrokeType(StrokeType.INSIDE);
    mainCircle.setMouseTransparent(true);

    pane = new Pane(ring, mainCircle);

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:ColorSelector,代码行数:17,代码来源:ColorSelector.java

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

示例4: Text3DHelper

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public Text3DHelper(String text, String font, int size){
    this.text=text;
    list=new ArrayList<>();
    
    Text textNode = new Text(text);
    textNode.setFont(new Font(font,size));
    
    // Convert Text to Path
    Path subtract = (Path)(Shape.subtract(textNode, new Rectangle(0, 0)));
    // Convert Path elements into lists of points defining the perimeter (exterior or interior)
    subtract.getElements().forEach(this::getPoints);
    
    // Group exterior polygons with their interior polygons
    polis.stream().filter(LineSegment::isHole).forEach(hole->{
        polis.stream().filter(poly->!poly.isHole())
                .filter(poly->!((Path)Shape.intersect(poly.getPath(), hole.getPath())).getElements().isEmpty())
                .filter(poly->poly.getPath().contains(new Point2D(hole.getOrigen().x,hole.getOrigen().y)))
                .forEach(poly->poly.addHole(hole));
    });        
    polis.removeIf(LineSegment::isHole);                
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:22,代码来源:Text3DHelper.java

示例5: LoadingCircle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public LoadingCircle() {
    Circle circle = new Circle(20);
    circle.setFill(null);
    circle.setStroke(Color.WHITE);
    circle.setStrokeWidth(2);

    Rectangle rect = new Rectangle(20, 20);

    Shape shape = Shape.subtract(circle, rect);
    shape.setFill(Color.WHITE);

    getChildren().add(shape);

    animation = new RotateTransition(Duration.seconds(2.5), this);
    animation.setByAngle(-360);
    animation.setInterpolator(Interpolator.LINEAR);
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:20,代码来源:FarCry4Loading.java

示例6: TriCircle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public TriCircle() {
    Shape shape1 = Shape.subtract(new Circle(5), new Circle(2));
    shape1.setFill(Color.WHITE);

    Shape shape2 = Shape.subtract(new Circle(5), new Circle(2));
    shape2.setFill(Color.WHITE);
    shape2.setTranslateX(5);

    Shape shape3 = Shape.subtract(new Circle(5), new Circle(2));
    shape3.setFill(Color.WHITE);
    shape3.setTranslateX(2.5);
    shape3.setTranslateY(-5);

    getChildren().addAll(shape1, shape2, shape3);

    setEffect(new GaussianBlur(2));
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:18,代码来源:MKXMenuApp.java

示例7: Text3DHelper

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public Text3DHelper(String text, String font, int size){
    this.text=text;
    list=new ArrayList<>();

    //android will failed at this point because text has no font name
    Text textNode = new Text();
    textNode.setFont(new Font(font,size));
    textNode.setText(text);

    // Convert Text to Path
    Path subtract = (Path)(Shape.subtract(textNode, new Rectangle(0, 0)));
    // Convert Path elements into lists of points defining the perimeter (exterior or interior)
    Iterables.forEach(subtract.getElements(), this::getPoints);

    // Group exterior polygons with their interior polygons
    stream(polis).filter(LineSegment::isHole).forEach(hole->{
        stream(polis).filter(poly->!poly.isHole())
                .filter(poly->!((Path)Shape.intersect(poly.getPath(), hole.getPath())).getElements().isEmpty())
                .filter(poly->poly.getPath().contains(new Point2D(hole.getOrigen().x,hole.getOrigen().y)))
                .forEach(poly->poly.addHole(hole));
    });
    Iterables.removeIf(polis, LineSegment::isHole);
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:24,代码来源:Text3DHelper.java

示例8: createPiece

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private Shape createPiece() {
    Shape shape = createPieceRectangle();
    if (hasRightTab) {
        shape = Shape.union(shape,
                createPieceTab(69.5f, 0f, 10f, 17.5f, 50f, -12.5f, 11.5f,
                        25f, 56.25f, -14f, 6.25f, 56.25f, 14f, 6.25f));
    }
    if (hasBottomTab) {
        shape = Shape.union(shape,
                createPieceTab(0f, 69.5f, 17.5f, 10f, -12.5f, 50f, 25f,
                        11f, -14f, 56.25f, 6.25f, 14f, 56.25f, 6.25f));
    }
    if (hasLeftTab) {
        shape = Shape.subtract(shape,
                createPieceTab(-31f, 0f, 10f, 17.5f, -50f, -12.5f, 11f,
                        25f, -43.75f, -14f, 6.25f, -43.75f, 14f, 6.25f));
    }
    if (hasTopTab) {
        shape = Shape.subtract(shape,
                createPieceTab(0f, -31f, 17.5f, 10f, -12.5f, -50f, 25f,
                        12.5f, -14f, -43.75f, 6.25f, 14f, -43.75f, 6.25f));
    }
    shape.setTranslateX(correctX);
    shape.setTranslateY(correctY);
    shape.setLayoutX(50f);
    shape.setLayoutY(50f);
    return shape;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:PuzzlePieces.java

示例9: createPieceTab

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private Shape createPieceTab(double eclipseCenterX, double eclipseCenterY, double eclipseRadiusX, double eclipseRadiusY,
                             double rectangleX, double rectangleY, double rectangleWidth, double rectangleHeight,
                             double circle1CenterX, double circle1CenterY, double circle1Radius,
                             double circle2CenterX, double circle2CenterY, double circle2Radius) {
    Ellipse e = new Ellipse(eclipseCenterX, eclipseCenterY, eclipseRadiusX, eclipseRadiusY);
    Rectangle r = new Rectangle(rectangleX, rectangleY, rectangleWidth, rectangleHeight);
    Shape tab = Shape.union(e, r);
    Circle c1 = new Circle(circle1CenterX, circle1CenterY, circle1Radius);
    tab = Shape.subtract(tab, c1);
    Circle c2 = new Circle(circle2CenterX, circle2CenterY, circle2Radius);
    tab = Shape.subtract(tab, c2);
    return tab;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:PuzzlePieces.java

示例10: shapeToSvgString

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static String shapeToSvgString(final Shape SHAPE) {
    final StringBuilder fxPath = new StringBuilder();
    if (Line.class.equals(SHAPE.getClass())) {
        fxPath.append(convertLine((Line) SHAPE));
    } else if (Arc.class.equals(SHAPE.getClass())) {
        fxPath.append(convertArc((Arc) SHAPE));
    } else if (QuadCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertQuadCurve((QuadCurve) SHAPE));
    } else if (CubicCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCubicCurve((CubicCurve) SHAPE));
    } else if (Rectangle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertRectangle((Rectangle) SHAPE));
    } else if (Circle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCircle((Circle) SHAPE));
    } else if (Ellipse.class.equals(SHAPE.getClass())) {
        fxPath.append(convertEllipse((Ellipse) SHAPE));
    } else if (Text.class.equals(SHAPE.getClass())) {
        Path path = (Path)(Shape.subtract(SHAPE, new Rectangle(0, 0)));
        fxPath.append(convertPath(path));
    } else if (Path.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPath((Path) SHAPE));
    } else if (Polygon.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolygon((Polygon) SHAPE));
    } else if (Polyline.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolyline((Polyline) SHAPE));
    } else if (SVGPath.class.equals(SHAPE.getClass())) {
        fxPath.append(((SVGPath) SHAPE).getContent());
    }
    return fxPath.toString();
}
 
开发者ID:Simego,项目名称:FXImgurUploader,代码行数:31,代码来源:ShapeConverter.java

示例11: makeGrid

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private Shape makeGrid() {
    Shape shape = new Rectangle((COLUMNS + 1) * TILE_SIZE, (ROWS + 1) * TILE_SIZE);

    for (int y = 0; y < ROWS; y++) {
        for (int x = 0; x < COLUMNS; x++) {
            Circle circle = new Circle(TILE_SIZE / 2);
            circle.setCenterX(TILE_SIZE / 2);
            circle.setCenterY(TILE_SIZE / 2);
            circle.setTranslateX(x * (TILE_SIZE + 5) + TILE_SIZE / 4);
            circle.setTranslateY(y * (TILE_SIZE + 5) + TILE_SIZE / 4);

            shape = Shape.subtract(shape, circle);
        }
    }

    Light.Distant light = new Light.Distant();
    light.setAzimuth(45.0);
    light.setElevation(30.0);

    Lighting lighting = new Lighting();
    lighting.setLight(light);
    lighting.setSurfaceScale(5.0);

    shape.setFill(Color.BLUE);
    shape.setEffect(lighting);

    return shape;
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:29,代码来源:Connect4App.java

示例12: resize

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
@Override protected void resize() {
    double width  = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight();
    double height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom();
    size          = width < height ? width : height;

    if (width > 0 && height > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((width - size) * 0.5, (height - size) * 0.5);

        shadow.setRadius(size * 0.06);
        shadow.setOffsetX(size * 0.02);
        shadow.setOffsetY(size * 0.02);

        textShadow.setRadius(size * 0.0125);
        textShadow.setOffsetX(size * 0.00625);
        textShadow.setOffsetY(size * 0.00625);

        center = size * 0.5;

        valueText.setFont(Fonts.robotoBold(size * 0.20625));

        unitText.setFont(Fonts.robotoBold(size * 0.0875));

        Arc outerRing = new Arc(size * 0.5, size * 0.5,
                                size * 0.43125, size * 0.43125,
                                0, 360);
        outerRing.setFill(null);
        outerRing.setStroke(Color.WHITE);
        outerRing.setStrokeLineCap(StrokeLineCap.BUTT);
        outerRing.setStrokeWidth(size * 0.3);

        Arc innerRing = new Arc(size * 0.5, size * 0.5,
                                size * 0.43125, size * 0.43125,
                                0, 360);
        innerRing.setFill(null);
        innerRing.setStroke(Color.WHITE);
        innerRing.setStrokeLineCap(StrokeLineCap.BUTT);
        innerRing.setStrokeWidth(size * 0.1375);

        Shape shape = Shape.subtract(outerRing, innerRing);

        backgroundRing.setCenterX(center);
        backgroundRing.setCenterY(center);
        backgroundRing.setRadiusX(size * 0.43125);
        backgroundRing.setRadiusY(size * 0.43125);
        backgroundRing.setStrokeWidth(size * 0.1375);
        backgroundRing.setClip(shape);

        barBackground.setCenterX(center);
        barBackground.setCenterY(center);
        barBackground.setRadiusX(size * 0.43125);
        barBackground.setRadiusY(size * 0.43125);
        barBackground.setStrokeWidth(size * 0.1375);

        bar.setCenterX(center);
        bar.setCenterY(center);
        bar.setRadiusX(size * 0.43125);
        bar.setRadiusY(size * 0.43125);
        bar.setStrokeWidth(size * 0.1375);

        resizeValueText();
        resizeUnitText();
    }
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:65,代码来源:WhiteSkin.java

示例13: initGraphics

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barColor.get());

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(dropShadow);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    text = new Text(String.format(Locale.US, formatString, getTargetValue()));
    text.setFill(Color.WHITE);
    text.setTextOrigin(VPos.CENTER);

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    symbol = new Region();
    symbol.getStyleClass().setAll("symbol");
    symbol.setCacheHint(CacheHint.SPEED);

    icon = new FontIcon();
    icon.setTextOrigin(VPos.CENTER);

    iconPane = new StackPane(symbol, icon);

    pane = new Pane(barArc, ring, mainCircle, text, indicatorGroup, iconPane);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:regulators,代码行数:59,代码来源:Regulator.java

示例14: initGraphics

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    Stop[] stops = {
        new Stop(0.0, Color.rgb(135, 255, 190)),
        new Stop(0.125, Color.rgb(254, 190, 106)),
        new Stop(0.389, Color.rgb(252, 84, 68)),
        new Stop(0.611, Color.rgb(99, 195, 255)),
        new Stop(1.0, Color.rgb(125, 255, 190))
    };

    barGradient = new ConicalGradient(stops);

    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));

    overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    overlayBarArc.setType(ArcType.OPEN);
    overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND);
    overlayBarArc.setFill(null);
    overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3));
    overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get());

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(dropShadow);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    text = new Text(String.format(Locale.US, formatString, currentValue.get()));
    text.setFill(textColor.get());
    text.setTextOrigin(VPos.CENTER);

    targetText = new Text(String.format(Locale.US, formatString, targetValue.get()));
    targetText.setFill(textColor.get().darker());
    targetText.setTextOrigin(VPos.CENTER);
    targetText.setVisible((int) targetValue.get() != (int) currentValue.get());

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    symbol = new Region();
    symbol.getStyleClass().setAll("symbol");
    symbol.setCacheHint(CacheHint.SPEED);

    icon = new FontIcon();
    icon.setTextOrigin(VPos.CENTER);

    iconPane = new StackPane(symbol, icon);

    pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:regulators,代码行数:81,代码来源:FeedbackRegulator.java

示例15: QuarterCircle

import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public QuarterCircle(String name) {
    Circle circle = new Circle(50);
    circle.setFill(null);
    circle.setStroke(Color.BLACK);
    circle.setStrokeWidth(30);

    Rectangle rect = new Rectangle(200, 100);
    rect.setTranslateX(-100);

    shape = Shape.subtract(circle, rect);

    rect = new Rectangle(100, 100);
    rect.setTranslateY(-100);

    shape = Shape.subtract(shape, rect);
    shape.setRotate(45);
    shape.setStroke(Color.BLACK);

    text = new Text(name);
    text.setFill(Color.WHITE);

    setOpacity(0.6);

    getChildren().addAll(shape, text);

    LinearGradient gradient = new LinearGradient(1, 1, 0.2, 0.2, true, CycleMethod.NO_CYCLE, new Stop[] {
            new Stop(0.3, Color.GOLD),
            new Stop(0.9, Color.BLACK)
    });

    DropShadow shadow = new DropShadow(5, Color.WHITE);
    shadow.setInput(new Glow(0.8));

    setOnMouseEntered(event -> {
        setOpacity(0.9);
        shape.setFill(gradient);
        text.setFont(Font.font("", FontPosture.ITALIC, 12));
        text.setEffect(shadow);
    });
    setOnMouseExited(event -> {
        setOpacity(0.6);
        shape.setFill(Color.BLACK);
        text.setFont(Font.getDefault());
        text.setEffect(null);
    });
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:47,代码来源:Main.java


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