JavaFX CSS Error ( Property Stylesheets does not exist )

后端 未结 4 1890
故里飘歌
故里飘歌 2021-01-04 23:23

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 dis

4条回答
  •  攒了一身酷
    2021-01-04 23:59

    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.

提交回复
热议问题