在 JavaFx 中使用 Css 编辑菜单栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18130236/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 22:36:42  来源:igfitidea点击:

Edit MenuBar with Css in JavaFx

javacssjavafxmenubarscenebuilder

提问by Capriatto

Thanks for reading. I have trying to edit a menu-bar with css but the menu item don't changed.

谢谢阅读。我试图用 css 编辑菜单栏,但菜单项没有改变。

I realized the parts of menu-bar are: Menubar, menu, menu-items but the last one don't work rightly. Help

我意识到菜单栏的部分是:菜单栏,菜单,菜单项,但最后一个不能正常工作。帮助

.menu-bar{
  -fx-background-color: peru;
  -fx-border-color:  #f0cd90;
 -fx-border-width: 2

}

.menu-bar .label {
    -fx-font-size: 25 pt;
    -fx-font-family: "Segoe UI Light";
    -fx-text-fill: #dedede;

}


.menu:hover {
    -fx-background-color: #bc784e;
}

.menu-item .label{
     -fx-font-size: 25 pt;
    -fx-label-line-length: 8;
      -fx-background-color: #cc66ff;
}

I'm using Scene builder.

我正在使用场景构建器。

采纳答案by Khang Dq

Make:

制作:

.menu .label{     -fx-text-fill: black;}

Reference: https://forums.oracle.com/message/10402062

参考:https: //forums.oracle.com/message/10402062