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! )
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 is the name of my FXMLLoader.
You were creating an FXML in Scene Builder 2 and running in JDK 7. SB 2 "tries to" create Java 8 compatible FXML code. To fix the FXML:
<?import java.net.*?>in the imports
Add the below code at the end of parent pane, after
</children> (in my case it was before
<stylesheets> <URL value="@MainView.css" /> </stylesheets>