Java Code Examples for javafx.scene.Node#setMouseTransparent()

The following examples show how to use javafx.scene.Node#setMouseTransparent() . 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: Transitions.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void removeEffect(Node node, int duration) {
    if (node != null) {
        node.setMouseTransparent(false);
        removeEffectTimeLine = new Timeline();
        GaussianBlur blur = (GaussianBlur) node.getEffect();
        if (blur != null) {
            KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0);
            KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
            removeEffectTimeLine.getKeyFrames().add(kf1);

            ColorAdjust darken = (ColorAdjust) blur.getInput();
            KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0);
            KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
            removeEffectTimeLine.getKeyFrames().add(kf2);
            removeEffectTimeLine.setOnFinished(actionEvent -> {
                node.setEffect(null);
                removeEffectTimeLine = null;
            });
            removeEffectTimeLine.play();
        } else {
            node.setEffect(null);
            removeEffectTimeLine = null;
        }
    }
}
 
Example 2
Source File: MultipleAxesLineChart.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
private void bindMouseEvents(final LineChart<?, ?> baseChart, final Double strokeWidth) {
    getChildren().add(detailsWindow);
    detailsWindow.prefHeightProperty().bind(heightProperty());
    detailsWindow.prefWidthProperty().bind(widthProperty());
    detailsWindow.setMouseTransparent(true);

    setOnMouseMoved(null);
    setMouseTransparent(false);

    final Axis<?> xAxis = baseChart.getXAxis();
    final Axis<?> yAxis = baseChart.getYAxis();

    final Line xLine = new Line();
    final Line yLine = new Line();
    yLine.setFill(Color.GRAY);
    xLine.setFill(Color.GRAY);
    yLine.setStrokeWidth(strokeWidth / 2);
    xLine.setStrokeWidth(strokeWidth / 2);
    xLine.setVisible(false);
    yLine.setVisible(false);

    final Node chartBackground = baseChart.lookup(".chart-plot-background");
    for (final Node n : chartBackground.getParent().getChildrenUnmodifiable()) {
        if ((n != chartBackground) && (n != xAxis) && (n != yAxis)) {
            n.setMouseTransparent(true);
        }
    }
}
 
Example 3
Source File: JFXButtonSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateChildren() {
    super.updateChildren();
    if (buttonRippler != null) {
        getChildren().add(0, buttonRippler);
    }
    for (int i = 1; i < getChildren().size(); i++) {
        final Node child = getChildren().get(i);
        if (child instanceof Text) {
            child.setMouseTransparent(true);
        }
    }
}
 
Example 4
Source File: JFXListCell.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * this method is used to set some nodes in cell content as mouse transparent nodes
 * so clicking on them will trigger the ripple effect.
 */
protected void makeChildrenTransparent() {
    for (Node child : getChildren()) {
        if (child instanceof Label) {
            Set<Node> texts = child.lookupAll("Text");
            for (Node text : texts) {
                text.setMouseTransparent(true);
            }
        } else if (child instanceof Shape) {
            child.setMouseTransparent(true);
        }
    }
}