JavaFXCSS-菜单项中的字体颜色
我正在用JavaFX设置菜单栏的样式,我一直在尝试更改字体颜色 在菜单项中显示文本,但没有成功 这是我的CSS代码 我怎么做呢JavaFXCSS-菜单项中的字体颜色,css,javafx,colors,menuitem,menubar,Css,Javafx,Colors,Menuitem,Menubar,我正在用JavaFX设置菜单栏的样式,我一直在尝试更改字体颜色 在菜单项中显示文本,但没有成功 这是我的CSS代码 我怎么做呢 .menu-bar { -fx-background-color: darkslategray; -fx-opacity: 0.5; } .menu-bar .menu-button:hover, .menu-bar .menu-button:focused, .menu-bar .menu-button:showing { -fx-backg
.menu-bar {
-fx-background-color: darkslategray;
-fx-opacity: 0.5;
}
.menu-bar .menu-button:hover, .menu-bar .menu-button:focused, .menu-bar .menu-button:showing {
-fx-background: -fx-accent;
-fx-background-color: darkslategray;
-fx-opacity: 0.5;
-fx-text-fill: -fx-selection-bar-text;
}
.menu-item {
-fx-background-color: darkslategray;
-fx-padding: 0em 0em 0em 0em;
-fx-text-fill: greenyellow;
}
.context-menu {
-fx-skin: "com.sun.javafx.scene.control.skin.ContextMenuSkin";
-fx-background-color:darkslategray ;
-fx-background-insets: 0, 1, 2;
-fx-background-radius: 0 6 6 6, 0 5 5 5, 0 4 4 4;
-fx-padding: 0.333333em 0.083333em 0.666667em 0.083333em; /* 4 1 8 1 */
-fx-opacity: 0.9;
}
要在css中设置菜单项的文本样式,必须使用
.menu item.label{…}
等选择菜单项的标签
.menu-item .label{
-fx-text-fill: greenyellow;
}
我希望这能解决您的问题。当您想知道哪些类需要更改时,一个非常有用的资源是以下概述:可能重复的