title: changing text color of a Menu control in JavaFX with FXML/CSS
body: <p>I want to change the text color of the <em>Menu</em> control in <strong>JavaFX</strong>. Currently, the background color of the whole <em>Menu Bar</em> is set to white and the default text color for displaying <em>Menu</em>-s is also white, so I cannot see the actual control, therefore I want to set the text color of the <em>Menu</em> ("File") to black. How do I do that?</p>
  
  <p>Here's the <strong>FXML</strong> portion:</p>
  
  
  
  <pre><code>&lt;?import java.lang.*?&gt;
  &lt;?import java.net.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.paint.*?&gt;
  
  &lt;AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml"&gt;
    &lt;children&gt;
      &lt;MenuBar id="modBar" layoutX="176.0" layoutY="122.0" styleClass="modBar"&gt;
        &lt;menus&gt;
          &lt;Menu id="modItem" mnemonicParsing="false" styleClass="modItem" text="File" /&gt;
        &lt;/menus&gt;
        &lt;stylesheets&gt;
          &lt;URL value="test.css" /&gt;
        &lt;/stylesheets&gt;
      &lt;/MenuBar&gt;
    &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>Here's the <strong>CSS</strong> part:</p>
  
  <pre><code>.modBar
  {
      -fx-background-color: white;
  }
  .modItem
  {
      -fx-color: black;
  }
  </code></pre>
  
  <p>This doesn't work ("File" still remains <strong>white</strong>). What am I doing wrong? Also, another thing is that I cannot seem to apply <em>anything</em> with CSS to <strong>.modItem</strong> - it sort-of works in <strong>Scene Builder</strong>, but disappears once previewed (also the "Stylesheets" selector is missing on all <em>Menu</em>-s in SB).</p>