I want to change the text color of the
Menu control in JavaFX. When I create a
MenuBar in Scene Builder - it comes with 3
Menu controls by default ("*File*", "*Options*", "*Help*"). I have tried assigning a separate CSS
id for each
Menu control and using various combinations of properties to influence the
text color, but can't seem to get it right whatsoever. What I want to achieve is, i.e., display *"File*" in black, instead of default white.
FXML here:
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
<children>
<MenuBar id="modBar" layoutX="176.0" layoutY="122.0" styleClass="modBar">
<menus>
<Menu id="modItem" mnemonicParsing="false" styleClass="modItem" text="File" />
</menus>
<stylesheets>
<URL value="test.css" />
</stylesheets>
</MenuBar>
</children>
</AnchorPane>
CSS here:
.modBar
{
-fx-background-color: white;
}
.modItem
{
-fx-color: black;
}
I have also tried extracting the
caspian CSS and playing with various properties related to *.menu* and *.menu-bar*, but still can't see the one responsible for the color of the text in menu controls?
Any help would be greatly appreciated.