简体   繁体   中英

Javafx Css variable defination Error: Expected '<number>' while parsing 'font-size'

I get javaFx css parse error while defining new variables in css.

It perfectly runs ok with a given constant like: -fx-font-size: 10;

Here is the code:

.root {
    tab-label-text-size: 10;
}
.label {
    -fx-font-size: tab-label-text-size;
}

Whatever I tried, I couldnt get rid of this exception. I also used other variables like this and they also run ok.

Expected '' while parsing '-fx-font-size' at [9,19]

Maybe a bug in javaFx??

In JavaFX CSS you can assign a color constant:

* {
    -color : #f44242;
}

.button {
    -fx-text-fill: -color;
}

But unfortunately, font size constants are not supported by the CssParser

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM