javafx.scene.shape.Rectangle#setArcHeight ( )源码实例Demo

下面列出了javafx.scene.shape.Rectangle#setArcHeight ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: DevToolBox   文件: Undecorator.java
/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
    dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
    dockFeedback = new Rectangle(0, 0, 100, 100);
    dockFeedback.setArcHeight(10);
    dockFeedback.setArcWidth(10);
    dockFeedback.setFill(Color.TRANSPARENT);
    dockFeedback.setStroke(Color.BLACK);
    dockFeedback.setStrokeWidth(2);
    dockFeedback.setCache(true);
    dockFeedback.setCacheHint(CacheHint.SPEED);
    dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
    dockFeedback.setMouseTransparent(true);
    BorderPane borderpane = new BorderPane();
    borderpane.setStyle("-fx-background-color:transparent"); //J8
    borderpane.setCenter(dockFeedback);
    Scene scene = new Scene(borderpane);
    scene.setFill(Color.TRANSPARENT);
    dockFeedbackPopup.setScene(scene);
    dockFeedbackPopup.sizeToScene();
}
 
源代码2 项目: marathonv5   文件: FillTransitionSample.java
public FillTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);
    
    fillTransition = FillTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
源代码3 项目: jsilhouette   文件: Cross.java
@Override
protected void calculateShape() {
    double cx = getCenterX();
    double cy = getCenterY();
    double r = getRadius();
    double n = validateRoundness(getRoundness());
    double w = validateWidth(getWidth(), r);

    double arcWH = w * n;
    Rectangle beam1 = new Rectangle(cx - r, cy - (w / 2), r * 2, w);
    Rectangle beam2 = new Rectangle(cx - (w / 2), cy - r, w, r * 2);
    beam1.setArcWidth(arcWH);
    beam1.setArcHeight(arcWH);
    beam2.setArcWidth(arcWH);
    beam2.setArcHeight(arcWH);
    Shape shape = Shape.union(beam1, beam2);

    shape.getStyleClass().addAll("silhouette", "silhoutte-cross");

    setShape(shape);
}
 
源代码4 项目: netbeans   文件: TransitionRotate.java
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 140,140));

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
源代码5 项目: marathonv5   文件: RotateSample.java
public static Node createIconContent() {
    final Rectangle r1 = new Rectangle (0, 0, 64, 64);
    r1.setArcHeight(4);
    r1.setArcWidth(4);
    r1.setFill(Color.web("#ed4b00"));

    Polygon polygon = createArrow();
    polygon.setLayoutX(65);
    polygon.setLayoutY(5);
    polygon.setRotate(165);
    

    Rectangle r2 = new Rectangle (0, 0, 64, 64);
    r2.setArcHeight(15);
    r2.setArcWidth(15);
    r2.setFill(Color.web("#ed4b00"));
    r2.setRotate(60);
    r2.setOpacity(0.5);
    javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon);
    return new javafx.scene.Group(g);
}
 
源代码6 项目: marathonv5   文件: FadeTransitionSample.java
public FadeTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);
    
    fadeTransition = FadeTransitionBuilder.create()
        .duration(Duration.seconds(4))
        .node(rect)
        .fromValue(1)
        .toValue(0.2)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
源代码7 项目: FXGLGames   文件: TileViewComponent.java
public TileViewComponent() {
    Rectangle bg = new Rectangle(getAppWidth() / 3, getAppHeight() / 3, Color.rgb(13, 222, 236));

    Rectangle bg2 = new Rectangle(getAppWidth() / 4, getAppHeight() / 4, Color.rgb(250, 250, 250, 0.25));
    bg2.setArcWidth(25);
    bg2.setArcHeight(25);

    arc.setFill(null);
    arc.setStroke(Color.BLACK);
    arc.setStrokeWidth(3);

    line1.setStrokeWidth(3);
    line2.setStrokeWidth(3);

    line1.setVisible(false);
    line2.setVisible(false);

    getViewRoot().getChildren().addAll(new StackPane(bg, bg2, arc, line1, line2));
}
 
源代码8 项目: FXGLGames   文件: SpaceInvadersFactory.java
@Spawns("LaserBeam")
public Entity newLaserBeam(SpawnData data) {
    Rectangle view = new Rectangle(10, Config.HEIGHT - 25, Color.color(1.0, 1.0, 1.0, 0.86));
    view.setArcWidth(15);
    view.setArcHeight(15);
    view.setStroke(Color.BLUE);
    view.setStrokeWidth(1);

    return entityBuilder()
            .from(data)
            .type(LASER_BEAM)
            .viewWithBBox(view)
            .with(new CollidableComponent(true))
            .with(new LaserBeamComponent())
            .build();
}
 
源代码9 项目: marathonv5   文件: RotateSample.java
public static Node createIconContent() {
    final Rectangle r1 = new Rectangle (0, 0, 64, 64);
    r1.setArcHeight(4);
    r1.setArcWidth(4);
    r1.setFill(Color.web("#ed4b00"));

    Polygon polygon = createArrow();
    polygon.setLayoutX(65);
    polygon.setLayoutY(5);
    polygon.setRotate(165);
    

    Rectangle r2 = new Rectangle (0, 0, 64, 64);
    r2.setArcHeight(15);
    r2.setArcWidth(15);
    r2.setFill(Color.web("#ed4b00"));
    r2.setRotate(60);
    r2.setOpacity(0.5);
    javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon);
    return new javafx.scene.Group(g);
}
 
源代码10 项目: constellation   文件: OverviewPanel.java
/**
 * Helper method that creates and styles a POV object.
 *
 * The POV object is a styled rectangle that is used to indicate the
 * currently observed time range (aka time extent) on the timeline. It can
 * also be used to quickly interact with the time extent.
 *
 * @return A formatted POV object.
 */
private Rectangle createPOV() {
    final Rectangle rect = new Rectangle(135, 25, 60, 1);

    // Bind the height of the POV to the Height of the histogram:
    rect.yProperty().bind(histogram.heightProperty());
    rect.heightProperty().bind(innerPane.prefHeightProperty());
    rect.setManaged(true);

    // Style the rectangle:
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(2d);
    final LinearGradient gradient
            = new LinearGradient(0.0, 0.0, 0.0, 0.5, true, CycleMethod.NO_CYCLE, new Stop[]{
        new Stop(0, Color.LIGHTBLUE.darker()),
        new Stop(1, Color.TRANSPARENT)
    });
    rect.setFill(gradient);
    rect.setSmooth(true);

    // Round the edges of the rectangle:
    rect.setArcWidth(5.0);
    rect.setArcHeight(5.0);

    // Set the POV mouse event handlers:
    final POVMouseEventHandler handler = new POVMouseEventHandler(rect);
    rect.setOnMouseMoved(handler);
    rect.setOnMousePressed(handler);
    rect.setOnMouseDragged(handler);
    rect.setOnMouseReleased(handler);

    // Make the POV object the top-most object on this panel:
    rect.toFront();

    return rect;
}
 
源代码11 项目: FXGLGames   文件: SpaceLevel.java
public SpaceLevel() {
    Rectangle bg = new Rectangle(getAppWidth() - 20, 200, Color.color(0, 0, 0, 0.6));
    bg.setArcWidth(25);
    bg.setArcHeight(25);
    bg.setStroke(Color.color(0.1, 0.2, 0.86, 0.76));
    bg.setStrokeWidth(3);

    storyPane.setTranslateX(10);
    storyPane.setTranslateY(25);

    rootPane = new Pane(bg, storyPane);
    rootPane.setTranslateX(10);
    rootPane.setTranslateY(getAppHeight() - 200);
}
 
源代码12 项目: marathonv5   文件: RadialGradientSample.java
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
源代码13 项目: marathonv5   文件: RotateSample.java
public RotateSample() {
    super(220, 270);

    //create 2 rectangles
    Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75));
    Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5));

    //rotate the second one
    rect2.getTransforms().add(new Rotate(135, 90, 90)); // parameters are angle, pivotX and pivotY

    // rectangle with adjustable rotate
    Rectangle rect3 = new Rectangle(40, 180, 60, 60);
    rect3.setFill(Color.DODGERBLUE);
    rect3.setArcWidth(10);
    rect3.setArcHeight(10);
    rect3.setRotate(45);

    //show the rectangles
    getChildren().addAll(rect2, rect1, rect3);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Rotate", rect3.rotateProperty(), 0d, 360d)
    );
    // END REMOVE ME
    
    //create arrow
    Polygon polygon = createArrow();
    polygon.setLayoutX(110);
    polygon.setLayoutY(15);
    polygon.setRotate(135);

    getChildren().addAll(polygon);

}
 
源代码14 项目: marathonv5   文件: RadialGradientSample.java
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
源代码15 项目: marathonv5   文件: PauseTransitionSample.java
public PauseTransitionSample() {
    super(400,150);
    // create rectangle
    Rectangle rect = new Rectangle(-25,-25,50, 50);
    rect.setArcHeight(15);
    rect.setArcWidth(15);
    rect.setFill(Color.CRIMSON);
    rect.setTranslateX(50);
    rect.setTranslateY(75);
    getChildren().add(rect);
    
    animation = SequentialTransitionBuilder.create()
        .node(rect)
        .children(
            TranslateTransitionBuilder.create()
                .duration(Duration.seconds(2))
                .fromX(50)
                .toX(200)
                .build(),
            PauseTransitionBuilder.create()
                .duration(Duration.seconds(2))
                .build(),
            TranslateTransitionBuilder.create()
                .duration(Duration.seconds(2))
                .fromX(200)
                .toX(350)
                .build()
        )
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();                
}
 
源代码16 项目: mars-sim   文件: IOSApp.java
public ToggleSwitch() {
    Rectangle background = new Rectangle(100, 50);
    background.setArcWidth(50);
    background.setArcHeight(50);
    background.setFill(Color.WHITE);
    background.setStroke(Color.LIGHTGRAY);

    Circle trigger = new Circle(25);
    trigger.setCenterX(25);
    trigger.setCenterY(25);
    trigger.setFill(Color.WHITE);
    trigger.setStroke(Color.LIGHTGRAY);

    DropShadow shadow = new DropShadow();
    shadow.setRadius(2);
    trigger.setEffect(shadow);

    translateAnimation.setNode(trigger);
    fillAnimation.setShape(background);

    getChildren().addAll(background, trigger);

    switchedOn.addListener((obs, oldState, newState) -> {
        boolean isOn = newState.booleanValue();
        translateAnimation.setToX(isOn ? 100 - 50 : 0);
        fillAnimation.setFromValue(isOn ? Color.WHITE : Color.LIGHTGREEN);
        fillAnimation.setToValue(isOn ? Color.LIGHTGREEN : Color.WHITE);

        animation.play();
    });

    setOnMouseClicked(event -> {
        switchedOn.set(!switchedOn.get());
    });
}
 
源代码17 项目: tilesfx   文件: FluidTileSkin.java
@Override protected void resize() {
    super.resize();

    canvas.setWidth(width);
    canvas.setHeight(height);

    Rectangle clip = new Rectangle(width, height);
    if (tile.getRoundedCorners()) {
        clip.setArcWidth(clamp(0, Double.MAX_VALUE, size * 0.025));
        clip.setArcHeight(clamp(0, Double.MAX_VALUE, size * 0.025));
    }
    canvas.setClip(clip);

    resizeDynamicText();
    resizeStaticText();

    valueUnitFlow.setPrefWidth(width - size * 0.1);
    valueUnitFlow.relocate(size * 0.05, (height - valueUnitFlow.getLayoutBounds().getHeight()) * 0.5);
    valueUnitFlow.setMaxHeight(valueText.getFont().getSize());

    fractionLine.setStartX(width - 0.17 * size);
    fractionLine.setStartY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3);
    fractionLine.setEndX(width - 0.05 * size);
    fractionLine.setEndY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3);
    fractionLine.setStroke(tile.getUnitColor());
    fractionLine.setStrokeWidth(size * 0.005);

    unitFlow.setTranslateY(-size * 0.005);

    for( int i = 0 ; i < detail + 1 ; i++ ) {
        Point p = particles.get(i);
        p.x = width / (detail - 4) * (i - 2);
        p.y = height * (1d - tile.getCurrentValue());

        p.originalX = p.x;
        p.originalY = p.y;
    }
}
 
源代码18 项目: marathonv5   文件: RotateSample.java
public RotateSample() {
    super(220, 270);

    //create 2 rectangles
    Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75));
    Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5));

    //rotate the second one
    rect2.getTransforms().add(new Rotate(135, 90, 90)); // parameters are angle, pivotX and pivotY

    // rectangle with adjustable rotate
    Rectangle rect3 = new Rectangle(40, 180, 60, 60);
    rect3.setFill(Color.DODGERBLUE);
    rect3.setArcWidth(10);
    rect3.setArcHeight(10);
    rect3.setRotate(45);

    //show the rectangles
    getChildren().addAll(rect2, rect1, rect3);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Rotate", rect3.rotateProperty(), 0d, 360d)
    );
    // END REMOVE ME
    
    //create arrow
    Polygon polygon = createArrow();
    polygon.setLayoutX(110);
    polygon.setLayoutY(15);
    polygon.setRotate(135);

    getChildren().addAll(polygon);

}
 
源代码19 项目: Medusa   文件: PlainAmpSkin.java
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);
        }
    }

    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections       = ticksAndSectionsCanvas.getGraphicsContext2D();

    ledCanvas = new Canvas();
    led       = ledCanvas.getGraphicsContext2D();

    thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")");
    thresholdTooltip.setTextAlignment(TextAlignment.CENTER);

    threshold = new Path();
    Helper.enableNode(threshold, gauge.isThresholdVisible());
    Tooltip.install(threshold, thresholdTooltip);

    average = new Path();
    Helper.enableNode(average, gauge.isAverageVisible());

    markerPane = new Pane();

    needleRotate = new Rotate(180 - START_ANGLE);
    needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep);

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleLineTo5       = new LineTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleClosePath7    = new ClosePath();
    needle              = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);

    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

    shadowGroup = new Group(needle);
    shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null);

    unitText = new Text(gauge.getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);

    lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT);
    lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT);
    lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT);
    lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.66 * PREFERRED_HEIGHT);
    Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible());

    lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue()));
    lcdText.setAlignment(Pos.CENTER_RIGHT);
    lcdText.setVisible(gauge.isValueVisible());

    // Set initial value
    angleStep          = ANGLE_RANGE / gauge.getRange();
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
    targetAngle        = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle);
    needleRotate.setAngle(targetAngle);

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas,
                              markerPane,
                              ledCanvas,
                              unitText,
                              lcd,
                              lcdText,
                              shadowGroup);

    getChildren().setAll(pane);
}
 
源代码20 项目: marathonv5   文件: ParallelTransitionSample.java
public ParallelTransitionSample() {
    super(400,150);
    // create rectangle
    Rectangle rect = new Rectangle(-25,-25,50, 50);
    rect.setArcHeight(15);
    rect.setArcWidth(15);
    rect.setFill(Color.CRIMSON);
    rect.setTranslateX(50);
    rect.setTranslateY(75);
    getChildren().add(rect); 
    // create parallel transition to do all 4 transitions at the same time        
    parallelTransition = ParallelTransitionBuilder.create()
        .node(rect)
        .children(
            FadeTransitionBuilder.create()
                .duration(Duration.seconds(3))
                .node(rect)
                .fromValue(1)
                .toValue(0.3)
                .autoReverse(true)
                .build(),
            TranslateTransitionBuilder.create()
                .duration(Duration.seconds(2))
                .fromX(50)
                .toX(350)
                .cycleCount(2)
                .autoReverse(true)
                .build(),
            RotateTransitionBuilder.create()
                .duration(Duration.seconds(3))
                .byAngle(180)
                .cycleCount(4)
                .autoReverse(true)
                .build(),
            ScaleTransitionBuilder.create()
                .duration(Duration.seconds(2))
                .toX(2)
                .toY(2)
                .cycleCount(2)
                .autoReverse(true)
                .build()
        )
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
    
}