I have a image which I would like to edit with JavaFX. How I could add almost transparent rectangle and text similar to the image below?

enter image description here

有帮助吗?

解决方案

Use a VBox to wrap a Label or two and wrap that in a Pane or some other basic node. Style the label to get the desired text appearance, and style the highest node (the one wrapping your VBox) to have a semi-transparent background like so: -fx-background-color: #000000a8;. Change the last two characters ("a8") to achieve the desired level of transparency.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top