简体   繁体   中英

javafx and fxml based transparent background

There are many ways to make background of a pane or background scene as transparent.

e.g http://stackoverflow.com/questions/12717487/how-to-implement-a-transparent-pane-with-non-transparent-children

but how can I do that if i have an application made in fxml and controller based files?

when I already have made an application in fxml based files and the layout has an AnchorPane at the base and some other panes above it. how do I actually make the white background to transparent or semi transparent?

Unfortunately this is not an exact answer to your question, but hopefully it is helpful.

See JavaFX 2.2 Modal window dialog *with* FXML which provides information on loading fxml content into an overlaid window.

In the answer to there is a link to a sample NetBeans project which includes code demonstrating display of a window with non-fxml content which has a transparent background over the top of a window which has fxml content. However, the example could be generalized so that the content of the popup window with the transparent background was generated in fxml rather than JavaFX. The generalization could follow the techniques I outlined in the text of the answer to JavaFX 2.2 Modal window dialog *with* FXML .

The output of the sample project is shown below with the "Colossal Cave Adventure" window based on fxml and the transparent dialog not. I think to correctly answer your question, the sample would need to be extended such that the content of the transparent dialog was generated from fxml.

示例程序输出

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM