adding css file to stylesheets in javafx

前端 未结 18 1339
[愿得一人]
[愿得一人] 2020-12-06 05:27

Language: JavaFX

IDE: Netbeans

Problem: I\'m trying to add a css file to the stylesheet, but the first line of the following code always generates a Nu

18条回答
  •  臣服心动
    2020-12-06 05:48

    I think your're missing the slashes which causes that the CSS file can't be found. Try to correct your path reference.

    For example:

    -root
    --app/Main.java
    --assets/double_slider.css
    

    would be:

    String css = this.getClass().getResource("/assets/double_slider.css").toExternalForm();
    

提交回复
热议问题