3

Similar to this question (which is about CSS usage in HTML pages), I am interested if it possible to detect which CSS rules are applied within a JavaFX application to the different nodes.

We currently use Scenic View to inspect UI elements and their properties. This works fine to check the controls' properties (e.g., a text field's font)... Yet, the tool does not help to derive which rule from which file has been applied (e.g., based on which CSS rule bold has been used as font style). Is this somehow possible?


Additional info: Why am I interested in CSS usage? We have multiple custom controls, which may embed each other, and each of which may have its own .css file. We want to be able to analyze that all CSS styling is applied correctly and to ensure that the correct file is used.

Markus Weninger
  • 11,931
  • 7
  • 64
  • 137
  • If you are using `FXML`, `SceneBuilder` has a `CSS` tool. I don't know if it does what you are asking though. – SedJ601 Sep 10 '18 at 13:43
  • 1
    @Sedrick We use FXML, but write it by hand without using SceneBuilder. But thanks for the hint, we will have a look at it. – Markus Weninger Sep 10 '18 at 13:44
  • Starting with JavaFX 9 some API became available that would allow you to parse styles, test, if a style is applicable to a node and determine specificity. (see [`javafx.css` package](https://docs.oracle.com/javase/9/docs/api/javafx/css/package-summary.html)). I don't know, if something like this exists for javafx 8 though. – fabian Sep 10 '18 at 23:02

0 Answers0