Java Code Examples for javafx.scene.shape.Circle#setCenterY()

The following examples show how to use javafx.scene.shape.Circle#setCenterY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserDetail.java    From DashboardFx with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node icon() {
    Image image = new Image(getClass().getResource("/com/gn/media/img/avatar.png").toExternalForm());
    ImageView imageView = new ImageView(image);
    imageView.setFitHeight(30);
    imageView.setFitWidth(30);

    Circle circle = new Circle(12);
    circle.setStroke(Color.WHITE);
    circle.setStrokeWidth(5);
    circle.setCenterX(imageView.getFitWidth() / 2);
    circle.setCenterY(imageView.getFitHeight() / 2);
    imageView.setClip(circle);

    return imageView;
}
 
Example 2
Source File: RadialColorMenu.java    From RadialFx with GNU Lesser General Public License v3.0 6 votes vote down vote up
public RadialColorMenu() {
selectedColor = new SimpleObjectProperty<Paint>(Color.BLACK);
itemExtMouseHandler = new ItemExtEventHandler();

final Color[] colors = new Color[] { Color.BLACK, Color.web("00275b"),
	Color.web("008021"), Color.web("8e0000"), Color.web("ff8800") };

int i = 0;
for (final Color color : colors) {

    addColorItem(color, i * 360d / colors.length, 360d / colors.length);

    i++;
}

final Circle center = new Circle();
center.fillProperty().bind(selectedColor);
center.setRadius(40);
center.setCenterX(0);
center.setCenterY(0);

getChildren().add(center);
   }
 
Example 3
Source File: CSSFXTesterApp.java    From cssfx with Apache License 2.0 6 votes vote down vote up
private Group buildCirclePane(int prefWidth, int prefHeight) {
    Group freePlacePane = new Group();
    int defaultShapeSize = 50;
    int shapeNumber = 10;
    Random r = new Random();

    for (int i = 0; i < shapeNumber; i++) {
        Circle c = new Circle(Math.max(10, defaultShapeSize * r.nextInt(100) / 100));
        c.getStyleClass().add("circle");
        if (i % 2 == 0) {
            c.getStyleClass().add("even");
        } else {
            c.getStyleClass().add("odd");
        }
        c.setCenterX(r.nextInt(prefWidth));
        c.setCenterY(r.nextInt(prefHeight));
        c.setFill(Color.BLUE);
        freePlacePane.getChildren().add(c);
    }

    freePlacePane.getStyleClass().add("circles");
    freePlacePane.prefWidth(250);
    freePlacePane.prefWidth(200);
    return freePlacePane;
}
 
Example 4
Source File: DockZones.java    From AnchorFX with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void buildCircleStage() {

        circleStage = new Stage();
        circleStage.initStyle(StageStyle.TRANSPARENT);
        circleStage.initOwner(this);

        circleZone = new Circle(CIRCLE_RADIUS);
        circleZone.setCenterX(CIRCLE_RADIUS);
        circleZone.setCenterY(CIRCLE_RADIUS);
        circleZone.getStyleClass().add("dockzone-circle-container-selectors");

        circleStageRoot = new Pane(circleZone);
        circleStageRoot.setStyle("-fx-background-color:rgba(0,0,0,0);");

        circleStageScene = new Scene(circleStageRoot, CIRCLE_RADIUS * 2, CIRCLE_RADIUS * 2, Color.TRANSPARENT);

        circleStage.setScene(circleStageScene);

        circleStageRoot.setOpacity(0);
    }
 
Example 5
Source File: ZoneSelector.java    From AnchorFX with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void buildUI(Image image, double x, double y)
{    
    setPrefWidth(image.getWidth());
    setPrefHeight(image.getHeight());
    
    iconView = new ImageView(image);  
    setStyle("-fx-background-color:rgba(0,0,0,0);");
    
    iconCircle = new Circle(image.getWidth()/2+10);
    iconCircle.setCenterX(getPrefWidth() / 2);
    iconCircle.setCenterY(getPrefHeight() / 2);
    iconCircle.getStyleClass().add("dockzone-circle-selector");
    
    iconView.relocate((getPrefWidth()-image.getWidth()) / 2, (getPrefWidth()-image.getHeight()) / 2);
    
    getChildren().addAll(iconCircle,iconView);
    
    parent.getChildren().add(this);
    relocate(x, y); 
}
 
Example 6
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 7
Source File: IOSApp.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
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());
    });
}
 
Example 8
Source File: Connect4App.java    From FXTutorials with MIT License 5 votes vote down vote up
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;
}
 
Example 9
Source File: IOSApp.java    From FXTutorials with MIT License 5 votes vote down vote up
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());
    });
}
 
Example 10
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 11
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 12
Source File: Exercise_15_19.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** Set a circle with a random color and a random location the pane */
private void setRandomProperties(Circle c, double width, double height) {
	c.setFill(Color.color(Math.random(), Math.random(), Math.random()));
	c.setCenterX(c.getRadius() + Math.random() * 
		(width - c.getRadius() * 2));
	c.setCenterY(c.getRadius() + Math.random() * 
		(height - c.getRadius() * 2));
}
 
Example 13
Source File: PopOverSkin.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private Node createCloseIcon() {
    Group group = new Group();
    group.getStyleClass().add("graphics"); //$NON-NLS-1$

    Circle circle = new Circle();
    circle.getStyleClass().add("circle"); //$NON-NLS-1$
    circle.setRadius(6);
    circle.setCenterX(6);
    circle.setCenterY(6);
    group.getChildren().add(circle);

    Line line1 = new Line();
    line1.getStyleClass().add("line"); //$NON-NLS-1$
    line1.setStartX(4);
    line1.setStartY(4);
    line1.setEndX(8);
    line1.setEndY(8);
    group.getChildren().add(line1);

    Line line2 = new Line();
    line2.getStyleClass().add("line"); //$NON-NLS-1$
    line2.setStartX(8);
    line2.setStartY(4);
    line2.setEndX(4);
    line2.setEndY(8);
    group.getChildren().add(line2);

    return group;
}
 
Example 14
Source File: BezierOffsetSnippet.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
protected void updateControlPoints() {
	controlPointsGroup.getChildren().clear();
	for (int i = 0; i < controlPoints.size(); i++) {
		// get point
		Point cp = controlPoints.get(i);
		// create visual
		Circle cpVisual = new Circle(5);
		cpVisual.setCenterX(cp.x);
		cpVisual.setCenterY(cp.y);
		// bind colors
		cpVisual.strokeProperty().bind(controlPointsColorProperty);
		cpVisual.fillProperty().bind(controlPointsFillColorBinding);
		// add to view
		controlPointsGroup.getChildren().add(cpVisual);
		// register interactions
		final int index = i;
		final double[] cX = new double[] { 0d };
		final double[] cY = new double[] { 0d };
		final double[] initX = new double[] { 0d };
		final double[] initY = new double[] { 0d };
		cpVisual.setOnMousePressed((me) -> {
			validation = false;
			initX[0] = me.getSceneX();
			initY[0] = me.getSceneY();
			cX[0] = cpVisual.getCenterX();
			cY[0] = cpVisual.getCenterY();
		});
		cpVisual.setOnMouseDragged((me) -> {
			Point pos = new Point(cX[0] + me.getSceneX() - initX[0],
					cY[0] + me.getSceneY() - initY[0]);
			controlPoints.set(index, pos);
			cpVisual.setCenterX(pos.x);
			cpVisual.setCenterY(pos.y);
			refreshAll();
		});
		cpVisual.setOnMouseReleased((me) -> {
			validation = true;
			refreshAll();
		});
	}
}
 
Example 15
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
Example 16
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
Example 17
Source File: BlendEffect.java    From Learn-Java-12-Programming with MIT License 4 votes vote down vote up
private static Circle createCircle(int x, int y){
    Circle c = createCircle();
    c.setCenterX(x);
    c.setCenterY(y);
    return c;
}
 
Example 18
Source File: RippleEffect.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RippleEffect(ReadOnlyDoubleProperty containerWidth,
                    ReadOnlyDoubleProperty containerHeight,
                    Supplier<Background> containerBackground) {
    circleRipple = new Circle(0.1, rippleColor);
    circleRipple.setOpacity(0.0);
    // Optional box blur on ripple - smoother ripple effect
    //circleRipple.setEffect(new BoxBlur(3, 3, 2));
    // Fade effect bit longer to show edges on the end of animation
    final FadeTransition fadeTransition = new FadeTransition(rippleDuration, circleRipple);
    fadeTransition.setInterpolator(Interpolator.EASE_OUT);
    fadeTransition.setFromValue(1.0);
    fadeTransition.setToValue(0.0);
    final Timeline scaleRippleTimeline = new Timeline();
    final SequentialTransition parallelTransition = new SequentialTransition();
    parallelTransition.getChildren().addAll(
        scaleRippleTimeline,
        fadeTransition
    );
    // When ripple transition is finished then reset circleRipple to starting point
    parallelTransition.setOnFinished(event -> {
        circleRipple.setOpacity(0.0);
        circleRipple.setRadius(0.1);
    });
    this.handler = event -> {
        parallelTransition.stop();
        // Manually fire finish event
        parallelTransition.getOnFinished().handle(null);
        circleRipple.setCenterX(event.getX());
        circleRipple.setCenterY(event.getY());
        // Recalculate ripple size if size of button from last time was changed
        if (containerWidth.get() != lastRippleWidth || containerHeight.get() != lastRippleHeight) {
            lastRippleWidth = containerWidth.get();
            lastRippleHeight = containerHeight.get();
            rippleClip.setWidth(lastRippleWidth);
            rippleClip.setHeight(lastRippleHeight);
            try {
                rippleClip.setArcHeight(containerBackground.get().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
                rippleClip.setArcWidth(containerBackground.get().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
                circleRipple.setClip(rippleClip);
            } catch (Exception ignored) {
                // try block because of possible null of Background, fills ...
            }
            // Getting 45% of longest button's length, because we want edge of ripple effect always visible
            double circleRippleRadius = Math.max(containerHeight.get(), containerWidth.get()) * 0.45;
            final KeyValue keyValue = new KeyValue(circleRipple.radiusProperty(), circleRippleRadius, Interpolator.EASE_OUT);
            final KeyFrame keyFrame = new KeyFrame(rippleDuration, keyValue);
            scaleRippleTimeline.getKeyFrames().clear();
            scaleRippleTimeline.getKeyFrames().add(keyFrame);
        }
        parallelTransition.playFromStart();
    };
}