JavaFX 2: How to load stylesheet into a Scene subclass distributed as part of a library?

后端 未结 2 940
眼角桃花
眼角桃花 2021-01-14 07:19

I\'m subclassing many of the JavaFX 2 classes to distribute them as part of a library that will be used by others. This requires that a stylesheet (part of the library) be a

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-14 07:50

    I've only had luck with this syntax as found in the Ensemble sample:

    scene.getStylesheets().addAll(Ensemble2.class.getResource("ensemble2.css").toExternalForm());
    

提交回复
热议问题