[英]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? 我正在尝试使用JavaFX创建游戏,我想知道是否可以将场景的边框设置为其他颜色,例如黑色或灰色? I happen to be using stack pane as my scene to display the game.
我碰巧正在使用堆栈窗格作为显示游戏的场景。
You can do this with css. 您可以使用CSS执行此操作。 Create a css file, set the file as the stylesheet for the pane, and add this code to the stylesheet:
创建一个css文件,将该文件设置为窗格的样式表,然后将此代码添加到样式表中:
.root {
-fx-border-color: black;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.