简体   繁体   中英

How to set the border of a scene to a different color JavaFX?

I am trying to create a game using JavaFX and I wanted to know if it was possible to set the border of the scene to a different color like black or gray? I happen to be using stack pane as my scene to display the game.

You can do this with css. Create a css file, set the file as the stylesheet for the pane, and add this code to the stylesheet:

.root {
    -fx-border-color: black;
}

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