Where to store css style sheet for sbt ScalaFX project

52 views Asked by At

Does anyone know where in an sbt directory structure ScalaFX looks for CSS style sheets? I've tried putting them in the same directory as my ScalaFX app main file, in a resources directory, directly in src, and pretty much everywhere else - yet every time I get a message saying Resource "whatever path I'm using/style.css" not found.

1

There are 1 answers

0
Jarek On BEST ANSWER

In SBT project you put CSS stylesheets in src/main/resources

You can see an example project using CSS here https://github.com/scalafx/scalafx-ensemble

Assuming that your stylesheet is in src/main/resources/path/my.css you can load it like this

scene = new Scene {
  stylesheets += this.getClass.getResource("/path/my.css").toExternalForm
  ...
}