JavaFX CSS Error ( Property Stylesheets does not exist )

css, intellij-idea, java, javafx

Solution

It turns out I needed to manually link the stylesheet in my start() method as JavaFX7 does not support the stylesheets tag.

To fix this I called the following command in my Start() method

root.getStylesheets().add(this.getClass().getResource("view/MainView.css").toExt‌​ernalForm());

Where `root` is the name of my FXMLLoader.

Problem

I have just began building a JavaFX application in IntelliJ using the latest Java7 SDK. I have built my interface using Oracle Scene Builder, everything runs and displays fine on the preview, but when I try and compile my program I get the following error ``` `Property "stylesheets" does not exist or is read-only` ``` Judging against JavaFX Documentation the line `stylesheets="@MainView.css"` in my FXML does not appear invalid. Does anybody know why I am getting this error? ( If I remove the link to the stylesheet my program compiles just fine, so the problem lies solely with the stylesheet, I'm stumped! )

Original source