Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Prevent child controls from being drawn outside of the parent control

ytwApr 9 2012 — edited Apr 9 2012
Hello,

I have some code like below to create a rounded box.

VBox box = new VBox();
box.setStyle("-fx-border-width: 5; -fx-border-color: red; -fx-border-radius: 33; -fx-background-color: green; -fx-background-radius: 33;");

That worked, but the problem now is that parts of the child controls that are placed near the corners are drawn outside of the parent box. Is there a way to 'clip' the child controls against the rounded corners of the parent control so the child controls aren't drawn outside of the parent? I guess I need the equivalent of "overflow: hidden;" in css.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2012
Added on Apr 9 2012
1 comment
590 views