title: Styling button in javaFX using CSS
body: <p>I have a problem with styling button in javaFX using CSS.
  I use Intellij Idea IDE.
  I have CSS.css file : </p>
  
  <pre><code>#Button {
      -fx-padding: 8 15 15 15;
      -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0;
      -fx-background-radius: 8;
      -fx-background-color: 
          linear-gradient(from 0% 93% to 0% 100%, #a34313 0%, #903b12 100%),
          #9d4024,
          #d86e3a,
          radial-gradient(center 50% 50%, radius 100%, #d86e3a, #c54e2c);
      -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 );
      -fx-font-weight: bold;
      -fx-font-size: 1.1em;
  }
  #Button:hover {
      -fx-background-color: 
          linear-gradient(from 0% 93% to 0% 100%, #a34313 0%, #903b12 100%),
          #9d4024,
          #d86e3a,
          radial-gradient(center 50% 50%, radius 100%, #ea7f4b, #c54e2c);
  }
  #Button:pressed {
      -fx-padding: 10 15 13 15;
      -fx-background-insets: 2 0 0 0,2 0 3 0, 2 0 4 0, 2 0 5 0;
  }
  #Button Text {
      -fx-fill: white;
      -fx-effect: dropshadow( gaussian , #a30000 , 0,0,0,2 );
  }
  </code></pre>
  
  <p>sample.FXML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  
  &lt;AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="94.0" prefWidth="271.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"&gt;
     &lt;children&gt;
        &lt;Button id="Button" layoutX="74.0" layoutY="26.0" mnemonicParsing="false" stylesheets="@../../../../Desktop/CSS.css" text="MyButtonStyle" /&gt;
     &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>and this is the main class : 
  package sample;</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.scene.layout.AnchorPane;
  import javafx.stage.Stage;
  
  public class Main extends Application {
  
      @Override
      public void start(Stage primaryStage) throws Exception{
          AnchorPane root = FXMLLoader.load(getClass().getResource("sample.fxml"));
          primaryStage.setTitle("Test");
          primaryStage.setScene(new Scene(root, root.getPrefWidth(), root.getPrefHeight()));
          primaryStage.show();
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>in javaFX Scene builder the button style is changed : </p>
  
  <p><img src="https://i.stack.imgur.com/3pWOo.jpg" alt="enter image description here"></p>
  
  <p>But when I compile my code the button get the default CSS style :
  <img src="https://i.stack.imgur.com/4HUFS.jpg" alt="enter image description here"></p>
  
  <p>Why when I compile my code the button style dosen't change?</p>