Perhaps a little basic question, but is it possible to style elements of a table by classname in JavaFX. So for example like this:
MyClassname .table-view .column-header .label {
-fx-text-fill:#F00;
}
I want this to style multiple tables within 1 stylesheet.
thanks in advance
Specify the full path to your class from root.
Yes, styling based upon class name selectors is supported - it's based on
Node.getTypeSelector()
, which comes from theStyleable
interface.So you could style all Labels to have a green text fill using the CSS rule:
Most nodes also have style classes which are set on them by the application or, if it is a standard control, by the JavaFX framework. The standard way most people code is not to use the type selectors but to use style class selectors instead:
The type selector information is documented in the JavaFX CSS reference guide: