I tried using methods suggested on this link but the semicircles just didn't look like a semicircle; Is there a better way?
Using the -fx-shape
property of Region
(see CSS Reference ) you can create a semicircular shaped Button
.
button.setStyle(
"-fx-shape:\"M0 0A1,1 0 0 0 2,0Z\";"
// ensure x/y-scaling of shape will be 1:1
+ "-fx-min-height: 100;"
+ "-fx-min-width: 200;"
+ "-fx-max-height: 100;"
+ "-fx-max-width: 200;"
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.