JavaFX Marquee go out of my node

前端 未结 1 420
遇见更好的自我
遇见更好的自我 2021-01-07 04:19

I have a issue with my Marquee animation with JavaFX. I have a HBox with three Nodes and in the second node I have a Text node inside that I need do the Marquee transformati

1条回答
  •  清酒与你
    2021-01-07 04:51

    Simply add a Rectangle as clip for the product pane and bind it's size to the size of the pane:

    Rectangle clip = new Rectangle();
    product.layoutBoundsProperty().addListener((observable, oldValue, newValue) -> {
        clip.setWidth(newValue.getWidth());
        clip.setHeight(newValue.getHeight());
    });
    product.setClip(clip);
    

    This will make sure no descendants of product are drawn outside the bounds of this node.

    0 讨论(0)
提交回复
热议问题